/* =============================================================================
   QUILLPO - APPLICATION INTERFACE STYLES
   A clean, modern interface for content creation and AI detection
   ============================================================================= */

/* =============================================================================
   1. CSS CUSTOM PROPERTIES & DESIGN TOKENS
   ============================================================================= */

:root {
    /* Colors */
    --primary-600: #667eea;
    --primary-700: #5a6fd8;
    --primary-800: #4c5bc4;
    --secondary-600: #764ba2;
    --secondary-700: #6a4190;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --white: #ffffff;
    --black: #000000;
    
    --success-500: #10b981;
    --success-100: #d1fae5;
    --warning-500: #f59e0b;
    --warning-100: #fef3c7;
    --danger-500: #dc3545;
    --danger-600: #c82333;
    --info-500: #007bff;
    --info-600: #0056b3;
    
    /* Typography */
    --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-serif: Georgia, 'Times New Roman', serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    
    /* Font Sizes */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    --text-5xl: 3rem;      /* 48px */
    
    /* Spacing */
    --space-1: 0.25rem;    /* 4px */
    --space-2: 0.5rem;     /* 8px */
    --space-3: 0.75rem;    /* 12px */
    --space-4: 1rem;       /* 16px */
    --space-5: 1.25rem;    /* 20px */
    --space-6: 1.5rem;     /* 24px */
    --space-8: 2rem;       /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */
    --space-32: 8rem;      /* 128px */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Borders */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    
    /* Layout */
    --max-width-xs: 20rem;
    --max-width-sm: 24rem;
    --max-width-md: 28rem;
    --max-width-lg: 32rem;
    --max-width-xl: 36rem;
    --max-width-2xl: 42rem;
    --max-width-3xl: 48rem;
    --max-width-4xl: 56rem;
    --max-width-5xl: 64rem;
    --max-width-6xl: 72rem;
    --max-width-7xl: 80rem;
    
    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

/* =============================================================================
   2. CSS RESET & BASE STYLES
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-sans);
    background: var(--white);
    color: var(--gray-800);
    height: 100vh;
    overflow: hidden;
}

/* =============================================================================
   3. AUTHENTICATION OVERLAY & MODAL
   ============================================================================= */

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-2xl);
    padding: var(--space-16);
    box-shadow: var(--shadow-2xl);
    max-width: 600px;
    width: 95%;
    text-align: center;
    animation: authSlideIn 0.8s ease-out;
}

@keyframes authSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-header {
    margin-bottom: var(--space-8);
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-8);
}

.auth-logo .logo-icon {
    width: 100px;
    height: 100px;
    border-radius: var(--border-radius-2xl);
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
}

.auth-subtitle {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin: 0;
    font-weight: 500;
    text-align: center;
}

.auth-quota-info {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin: 8px 0 0 0;
    font-weight: 400;
    text-align: center;
}

.auth-upgrade-message {
    font-size: var(--text-base);
    color: var(--primary-600);
    margin: 8px 0 0 0;
    font-weight: 600;
    text-align: center;
}

/* =============================================================================
   4. REVIEW CAROUSEL
   ============================================================================= */

.auth-reviews {
    margin: 20px 0;
    text-align: center;
}

.review-carousel {
    position: relative;
    height: 140px;
    overflow: hidden;
}

.review-item {
    display: none;
    align-items: center;
    gap: 16px;
    padding: var(--space-5);
}

.review-item.active {
    display: flex;
}

.review-avatar {
    flex-shrink: 0;
}

.review-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
}

.review-content {
    text-align: left;
    flex: 1;
}

.review-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.review-stars .star {
    color: #ffc107;
    font-size: 16px;
    line-height: 1;
}

.review-content p {
    font-size: var(--text-sm);
    color: #495057;
    margin: 0 0 8px 0;
    line-height: 1.4;
    font-style: italic;
}

.review-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.review-author strong {
    font-size: var(--text-xs);
    color: var(--gray-800);
    font-weight: 600;
}

.review-author span {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.review-dots {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-top: 20px;
}

.review-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.review-dot.active {
    background: #667eea;
}

.review-dot:hover {
    background: #a0aec0;
}

/* =============================================================================
   5. AUTHENTICATION CONTENT & FORMS
   ============================================================================= */

.auth-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.auth-message {
    text-align: center;
    margin-bottom: var(--space-5);
}

.auth-message h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.auth-signin {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.btn-google-signin {
    background: var(--white);
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.btn-google-signin:hover {
    background: var(--gray-50);
    border-color: #dadce0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.btn-google-signin:active {
    background: #f1f3f4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-terms {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.auth-terms p {
    font-size: var(--text-xs);
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0;
}

.auth-terms a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-terms a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    color: var(--gray-500);
    font-size: var(--text-sm);
    margin-top: 15px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   6. MAIN CONTENT & LAYOUT
   ============================================================================= */

.main-content.auth-required {
    filter: blur(2px);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    opacity: 0.7;
}

.main-content {
    display: flex;
    height: calc(100vh - var(--space-20));
    min-height: 0;
    position: relative;
}

/* =============================================================================
   7. TOP BAR & NAVIGATION
   ============================================================================= */

.top-bar {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--space-20);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--border-radius-lg);
}

.version {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--gray-500);
    margin-left: var(--space-2);
    opacity: 0.8;
}

/* =============================================================================
   8. USER AUTHENTICATION & PROFILE
   ============================================================================= */

.user-section {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.btn-signin {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.btn-signin:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.btn-signin:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.btn-signin:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: var(--text-xs);
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-signout {
    background: var(--danger-500);
    color: white;
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-signout:hover {
    background: var(--danger-600);
    border-color: #bd2130;
}

/* =============================================================================
   9. PROFILE DROPDOWN
   ============================================================================= */

.profile-section {
    position: relative;
    margin-left: 12px;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--gray-200);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-avatar:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    animation: dropdownSlideIn 0.2s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-info {
    padding: 12px 16px;
}

.profile-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.profile-email {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.profile-quota {
    margin-top: 8px;
    font-size: 11px;
    color: #495057;
}

.quota-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #ffc107 70%, #dc3545 90%);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.profile-divider {
    margin: 0;
    border: none;
    height: 1px;
    background: #e9ecef;
}

.profile-signout {
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    color: #495057;
    font-size: var(--text-sm);
    cursor: pointer;
    text-align: left;
    border-radius: 0 0 8px 8px;
    transition: background-color 0.2s;
}

.profile-signout:hover {
    background: var(--gray-50);
}

/* =============================================================================
   10. CONTROLS & OPTIONS
   ============================================================================= */

.controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.advanced-options {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: opacity 0.3s ease;
}

.advanced-options.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-group input[type="checkbox"] {
    margin: 0;
    accent-color: #007bff;
}

.option-group label {
    font-size: var(--text-xs);
    color: #495057;
    cursor: pointer;
    font-weight: 500;
}

.intensity-control {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-left: 1px solid #e9ecef;
    padding-left: 12px;
}

.intensity-slider {
    width: 80px;
    accent-color: #007bff;
}

.intensity-value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: #007bff;
    min-width: 20px;
}

.api-section {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* =============================================================================
   10. APP GRID & DROPDOWN
   ============================================================================= */

.app-grid-section {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.app-grid-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.app-grid-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left var(--transition-base);
}

.app-grid-toggle:hover::before {
    left: 100%;
}

.app-grid-toggle:hover {
    border-color: var(--primary-600);
    color: var(--primary-600);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.app-grid-toggle:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.2);
}

.app-grid-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-4);
    z-index: var(--z-dropdown);
    min-width: 280px;
    backdrop-filter: blur(20px);
    animation: dropdownSlideIn 0.2s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--border-radius-lg);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    justify-content: center;
}

.app-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-base);
}

.app-item:hover::before {
    left: 100%;
}

.app-item:hover {
    border-color: var(--gray-200);
    background: var(--gray-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-item.active {
    border-color: var(--gray-300);
    background: var(--gray-100);
    color: var(--gray-700);
    padding: var(--space-6);
}

.app-item.active:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

.app-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
    background: transparent;
    transition: all var(--transition-fast);
}

.app-item:hover .app-icon {
    transform: scale(1.05);
}

.app-item.active .app-icon {
    color: var(--primary-600);
}

.app-name {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--gray-700);
    text-align: center;
    line-height: 1.2;
    margin-top: var(--space-3);
}

.app-item.active .app-name {
    color: var(--gray-700);
    font-weight: 600;
}

/* =============================================================================
   11. MODE CONTROLS & TABS
   ============================================================================= */

.mode-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.mode-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    letter-spacing: -0.025em;
}

.mode-tabs {
    display: flex;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    padding: 4px;
    gap: 2px;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-500);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.mode-tab:hover {
    color: #495057;
    background: rgba(255, 255, 255, 0.5);
}

.mode-tab.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-tab.active:hover {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mode-tab svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* =============================================================================
   12. INPUT FIELDS & BUTTONS
   ============================================================================= */

.api-key-input {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-lg);
    font-size: var(--text-sm);
    width: 320px;
    background: white;
    transition: all 0.2s;
}

.api-key-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 40px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    background: var(--danger-500);
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background: var(--danger-600);
    border-color: #bd2130;
}

/* =============================================================================
   13. EDITOR PANELS & LAYOUT
   ============================================================================= */

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e9ecef;
    min-height: 0;
    position: relative;
}

.editor-panel:last-child {
    border-right: none;
}

.panel-header {
    background: var(--gray-50);
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    color: #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 58px;
    flex-shrink: 0;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.detection-score {
    font-size: var(--text-xs);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.score-human {
    background: #d4edda;
    color: #155724;
}

.score-ai {
    background: #f8d7da;
    color: #721c24;
}

.score-uncertain {
    background: #fff3cd;
    color: #856404;
}

/* =============================================================================
   14. PANEL ACTION BUTTONS
   ============================================================================= */

.btn-copy {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius-md);
    background: white;
    color: #495057;
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-copy:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: #adb5bd;
    color: #343a40;
}

.btn-copy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-copy.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.btn-upload {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius-md);
    background: white;
    color: #495057;
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-upload:hover {
    background: var(--gray-50);
    border-color: #adb5bd;
    color: #343a40;
}

.btn-upload:active {
    background: #e9ecef;
    transform: translateY(1px);
}

.btn-trash {
    padding: 6px 12px;
    border: 1px solid #dc3545;
    border-radius: var(--border-radius-md);
    background: white;
    color: #dc3545;
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-trash:hover {
    background: var(--danger-500);
    color: white;
}

.btn-trash:active {
    background: var(--danger-600);
    transform: translateY(1px);
}

/* =============================================================================
   15. DRAG & DROP FUNCTIONALITY
   ============================================================================= */

.quill-editor.drag-over {
    border: 2px dashed #007bff !important;
    background-color: rgba(0, 123, 255, 0.05) !important;
}

.quill-editor.drag-over .ql-editor {
    background-color: rgba(0, 123, 255, 0.02) !important;
}

/* =============================================================================
   16. MODAL DIALOGS
   ============================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body p {
    margin: 0;
    color: #495057;
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* =============================================================================
   17. QUILL EDITOR STYLES
   ============================================================================= */

.editor-container {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.quill-editor {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ql-toolbar {
    border-bottom: 1px solid #e9ecef !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    background: var(--white);
    flex-shrink: 0;
    height: 42px;
    display: flex;
    align-items: center;
    padding: 8px 12px;
}

.ql-toolbar .ql-formats {
    margin-right: 15px;
}

.ql-toolbar .ql-formats:last-child {
    margin-right: 0;
}

.ql-container {
    flex: 1;
    border: none !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ql-editor {
    font-size: var(--text-base);
    line-height: 1.7;
    padding: 24px;
    font-family: var(--font-family-serif);
    flex: 1;
    overflow-y: auto !important;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
}

.ql-editor.ql-blank::before {
    font-style: italic;
    color: #adb5bd;
    content: attr(data-placeholder);
    position: absolute;
    left: 24px;
    top: 24px;
    pointer-events: none;
    z-index: 1;
}

.ql-editor::-webkit-scrollbar {
    width: 8px;
}

.ql-editor::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}

.ql-editor::-webkit-scrollbar-thumb {
    background: #c1c8cd;
    border-radius: 4px;
    transition: background 0.2s;
}

.ql-editor::-webkit-scrollbar-thumb:hover {
    background: #a8b3ba;
}

.ql-editor {
    scrollbar-width: thin;
    scrollbar-color: #c1c8cd #f1f3f4;
}

/* =============================================================================
   18. STATISTICS & PROGRESS
   ============================================================================= */

.stats-bar {
    padding: 12px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    font-size: var(--text-xs);
    color: var(--gray-500);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    flex-shrink: 0;
    order: 999;
    margin-top: auto;
}

.stats-left {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-bar {
    position: fixed;
    top: var(--space-20);
    left: 0;
    right: 0;
    height: 3px;
    background: #e9ecef;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.progress-bar.active {
    opacity: 1;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.perplexity-meter {
    margin-top: 5px;
    width: 100%;
}

.meter-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
    display: block;
    margin-bottom: 5px;
}

.meter-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* =============================================================================
   19. NOTIFICATIONS & ALERTS
   ============================================================================= */

.notification {
    padding: 24px 32px;
    border-radius: 18px;
    color: #ffffff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 480px;
    max-width: 600px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 12px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    letter-spacing: -0.01em;
    transform: translateY(-20px) scale(0.95);
}

.notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.notification.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.92) 0%, rgba(16, 185, 129, 0.92) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.notification.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.92) 0%, rgba(244, 63, 94, 0.92) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.notification.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.92) 0%, rgba(147, 51, 234, 0.92) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.notification.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.92) 0%, rgba(251, 146, 60, 0.92) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    color: #ffffff;
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-lg);
    padding: 4px;
}

.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.notification-message {
    font-size: var(--text-base);
    opacity: 0.95;
    line-height: 1.5;
    font-weight: 500;
}

.notification-close {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.8;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.notification-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.notification-stack {
    position: fixed;
    top: 24px;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    pointer-events: none;
    max-width: 100vw;
}

.notification-stack .notification {
    position: relative;
    pointer-events: all;
}

/* =============================================================================
   20. PROCESSING & LOADING STATES
   ============================================================================= */

.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.6);
    backdrop-filter: blur(0.9px);
    -webkit-backdrop-filter: blur(0.9px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.processing-overlay.show {
    display: flex;
}

.processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: processingSpinAdvanced 1s linear infinite;
}

@keyframes processingSpinAdvanced {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.processing-text {
    font-size: var(--text-sm);
    color: #495057;
    font-weight: 500;
}

.quill-editor.disabled {
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =============================================================================
   21. ANIMATION KEYFRAMES
   ============================================================================= */

@keyframes slideInTopCenter {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-40px) scale(0.8);
        filter: blur(4px);
    }
    50% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(-8px) scale(1.02);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0px);
    }
}

@keyframes slideOutTopCenter {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.9);
        filter: blur(2px);
    }
}

@keyframes gentlePulse {
    0%, 100% {
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 12px 20px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.18), 0 15px 25px rgba(0, 0, 0, 0.1);
    }
}

/* =============================================================================
   22. RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1200px) {
    .advanced-options {
        display: none;
    }
    
    .api-key-input {
        width: 250px;
    }
}

@media (max-width: 1024px) {
    .top-bar {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .advanced-options {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    .editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        min-height: 300px;
        flex: none;
    }
    
    .top-bar {
        padding: 12px 16px;
        flex-wrap: wrap;
        height: auto;
        min-height: 120px;
    }
    
    .controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .logo {
        font-size: var(--text-lg);
    }
    
    .version {
        display: none;
    }
    
    .app-grid-dropdown {
        min-width: 240px;
        right: 0;
        left: auto;
    }
    
    .profile-dropdown {
        min-width: 180px;
    }
    
    .notification {
        min-width: 360px;
        max-width: 90vw;
        padding: 22px 28px;
        border-radius: 16px;
        margin: 0 16px;
    }
    
    .notification-stack {
        max-width: 90vw;
        gap: 16px;
    }
    
    .notification-title {
        font-size: var(--text-base);
    }
    
    .notification-message {
        font-size: var(--text-sm);
    }
    
    .notification-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 8px 12px;
        min-height: 100px;
    }
    
    .logo {
        font-size: var(--text-base);
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
    }
    
    .controls {
        gap: 6px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: var(--text-xs);
        height: 36px;
    }
    
    .app-grid-toggle {
        width: 32px;
        height: 32px;
    }
    
    .profile-avatar {
        width: 32px;
        height: 32px;
    }
    
    .main-content {
        height: calc(100vh - 100px);
    }
    
    .panel-header {
        padding: 12px 16px;
        height: 50px;
    }
    
    .stats-bar {
        padding: 8px 16px;
        height: 40px;
    }
    
    .ql-editor {
        padding: 16px;
    }
    
    .notification {
        min-width: 300px;
        padding: 16px 20px;
        border-radius: 12px;
    }
    
    .app-grid-dropdown {
        min-width: 200px;
        padding: var(--space-3);
    }
    
    .app-grid {
        gap: var(--space-2);
    }
    
    .app-item {
        padding: var(--space-3);
        min-height: 80px;
    }
    
    .app-icon {
        width: 48px;
        height: 48px;
    }
    
    .modal-content {
        max-width: 320px;
        margin: 0 16px;
    }
}