/* Professional Light Mode Humanizer UI - v3.7 */

/* Strict Reset for the Container */
#sph-humanizer-container,
#sph-humanizer-container * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

:root {
    --sph-bg-page: #f8fafc;
    --sph-bg-card: #ffffff;
    --sph-bg-header: #f1f5f9;
    --sph-border: #e2e8f0;
    
    --sph-primary: #4f46e5;
    --sph-primary-hover: #4338ca;
    
    --sph-text-main: #0f172a;
    --sph-text-sub: #64748b;
    --sph-text-placeholder: #94a3b8;
    --sph-danger: #ef4444;
    
    --sph-radius: 12px;
    --sph-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.sph-container {
    max-width: 1000px;
    margin: 0 auto !important;
    padding: 40px 20px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--sph-bg-page);
    color: var(--sph-text-main);
    width: 100%;
}

.sph-header {
    text-align: center;
    margin-bottom: 40px;
}

.sph-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--sph-text-main);
    margin-bottom: 12px !important;
    letter-spacing: -0.03em;
}

.sph-subtitle {
    color: var(--sph-text-sub);
    font-size: 1.1rem;
    margin: 0 !important;
}

.sph-editor-card {
    background: var(--sph-bg-card);
    border-radius: var(--sph-radius);
    box-shadow: var(--sph-shadow);
    border: 1px solid var(--sph-border);
    overflow: hidden;
    width: 100%;
}

/* Dual Pane Layout using Flexbox */
.sph-panes-wrapper {
    display: flex;
    flex-wrap: wrap;
    min-height: 400px;
    width: 100%;
}

.sph-pane {
    display: flex;
    flex-direction: column;
    width: 50%;
    position: relative;
}

/* The actual divider line */
.sph-pane-input {
    border-right: 1px solid var(--sph-border) !important;
}

/* Strict Fixed Height for Perfect Alignment */
.sph-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px !important;
    padding: 0 24px !important;
    background: var(--sph-bg-header);
    border-bottom: 1px solid var(--sph-border);
    width: 100%;
}

.sph-pane-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--sph-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 !important;
    line-height: 1;
}

.sph-word-count {
    font-size: 0.8rem;
    color: var(--sph-text-sub);
    background: var(--sph-bg-card);
    padding: 6px 12px !important;
    border-radius: 20px;
    border: 1px solid var(--sph-border);
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
}

.sph-word-count.limit-warning {
    color: #fff;
    background: var(--sph-danger);
    border-color: var(--sph-danger);
}

.sph-textarea {
    flex-grow: 1;
    width: 100%;
    border: none;
    padding: 24px !important;
    font-size: 1.05rem;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    color: var(--sph-text-main);
    background: var(--sph-bg-card);
    outline: none;
    min-height: 300px;
}

.sph-textarea::placeholder {
    color: var(--sph-text-placeholder);
}

.sph-result-area {
    flex-grow: 1;
    padding: 24px !important;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sph-bg-card);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--sph-text-main);
    width: 100%;
}

/* Force text to wrap correctly and prevent clipping */
#sph-result-text {
    padding: 0 !important;
    margin: 0 !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    width: 100% !important;
    max-width: 100% !important;
}

#sph-result-text p {
    margin: 0 0 1em 0 !important;
    padding: 0 !important;
}

.sph-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--sph-text-placeholder);
    gap: 16px;
    text-align: center;
    font-size: 1rem;
}

.sph-copy-btn {
    background: transparent;
    border: 1px solid var(--sph-border);
    color: var(--sph-text-sub);
    padding: 6px 16px !important;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1;
}

.sph-copy-btn:hover:not(:disabled) {
    background: var(--sph-primary);
    color: #fff;
    border-color: var(--sph-primary);
}

.sph-copy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    color: var(--sph-text-placeholder);
    border-color: var(--sph-border);
}

.sph-action-bar {
    padding: 20px 24px !important;
    border-top: 1px solid var(--sph-border);
    background: var(--sph-bg-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.sph-error-msg {
    color: var(--sph-danger);
    font-size: 0.95rem;
    font-weight: 500;
    flex-grow: 1;
    margin: 0 !important;
}

.sph-submit-btn {
    background: var(--sph-primary);
    color: #fff;
    border: none;
    padding: 14px 36px !important;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px 0 rgba(79, 70, 229, 0.2);
    white-space: nowrap;
}

.sph-submit-btn:hover:not(:disabled) {
    background: var(--sph-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sph-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sph-btn-loader {
    animation: sph-spin 1s linear infinite;
}

@keyframes sph-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
.sph-result-area::-webkit-scrollbar,
.sph-textarea::-webkit-scrollbar {
    width: 8px;
}
.sph-result-area::-webkit-scrollbar-track,
.sph-textarea::-webkit-scrollbar-track {
    background: var(--sph-bg-card);
}
.sph-result-area::-webkit-scrollbar-thumb,
.sph-textarea::-webkit-scrollbar-thumb {
    background: var(--sph-border);
    border-radius: 4px;
}
.sph-result-area::-webkit-scrollbar-thumb:hover,
.sph-textarea::-webkit-scrollbar-thumb:hover {
    background: var(--sph-text-sub);
}

/* Responsive */
@media (max-width: 768px) {
    .sph-pane {
        width: 100%;
    }
    .sph-pane-input {
        border-right: none !important;
        border-bottom: 1px solid var(--sph-border) !important;
    }
    .sph-title {
        font-size: 1.75rem;
    }
    .sph-action-bar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    .sph-submit-btn {
        justify-content: center;
    }
}