/**
 * PurpleButter Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --butter: #FFD859;
    --butter-light: #FFECA1;
    --butter-dark: #E6C24A;
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8f9fc;
    --card: #f8f9fc;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: -webkit-linear-gradient(315deg, #6B5B95 0%, #7B6BA5 45%, #8E7DB5 75%, #C9A86C 100%);
    background: -moz-linear-gradient(315deg, #6B5B95 0%, #7B6BA5 45%, #8E7DB5 75%, #C9A86C 100%);
    background: linear-gradient(135deg, #6B5B95 0%, #7B6BA5 45%, #8E7DB5 75%, #C9A86C 100%);
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: rgba(255, 216, 89, 0.3);
    -webkit-text-size-adjust: 100%;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(201, 168, 108, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(201, 168, 108, 0.1) 0%, transparent 35%),
        radial-gradient(circle at 50% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(142, 125, 181, 0.12) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Header
   ========================================================================== */

header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 1rem 0;
    -webkit-animation: fadeInDown 0.8s ease-out;
    -moz-animation: fadeInDown 0.8s ease-out;
    animation: fadeInDown 0.8s ease-out;
}

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

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

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

.logo-container {
    margin-bottom: 1rem;
    -webkit-filter: drop-shadow(0 4px 20px rgba(107, 91, 149, 0.4)) drop-shadow(0 0 25px rgba(201, 168, 108, 0.2));
    filter: drop-shadow(0 4px 20px rgba(107, 91, 149, 0.4)) drop-shadow(0 0 25px rgba(201, 168, 108, 0.2));
}

.logo-icon {
    -webkit-animation: logoFloat 4s ease-in-out infinite;
    -moz-animation: logoFloat 4s ease-in-out infinite;
    animation: logoFloat 4s ease-in-out infinite;
}

@-webkit-keyframes logoFloat {
    0%, 100% { -webkit-transform: translateY(0); transform: translateY(0); }
    50% { -webkit-transform: translateY(-8px); transform: translateY(-8px); }
}

@-moz-keyframes logoFloat {
    0%, 100% { -moz-transform: translateY(0); transform: translateY(0); }
    50% { -moz-transform: translateY(-8px); transform: translateY(-8px); }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

h1 {
    font-size: 2.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #D4B87A 50%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    -webkit-animation: shimmerText 4s linear infinite;
    -moz-animation: shimmerText 4s linear infinite;
    animation: shimmerText 4s linear infinite;
    text-shadow: none;
}

@-webkit-keyframes shimmerText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

@-moz-keyframes shimmerText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

@keyframes shimmerText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.125rem;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--card);
    border-radius: 20px;
    padding: 2rem;
    -webkit-box-shadow: var(--shadow-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
    -webkit-transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    -moz-transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    -webkit-animation: fadeInUp 0.6s ease-out backwards;
    -moz-animation: fadeInUp 0.6s ease-out backwards;
    animation: fadeInUp 0.6s ease-out backwards;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: -webkit-linear-gradient(left, transparent, rgba(255, 216, 89, 0.1), transparent);
    background: linear-gradient(90deg, transparent, rgba(255, 216, 89, 0.1), transparent);
    -webkit-transition: left 0.5s ease;
    -moz-transition: left 0.5s ease;
    transition: left 0.5s ease;
}

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

.card:hover {
    -webkit-transform: translateY(-4px);
    -moz-transform: translateY(-4px);
    transform: translateY(-4px);
    -webkit-box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -6px rgba(0, 0, 0, 0.1), 0 0 20px rgba(255, 216, 89, 0.15);
    box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -6px rgba(0, 0, 0, 0.1), 0 0 20px rgba(255, 216, 89, 0.15);
    border-color: rgba(255, 216, 89, 0.3);
}

.main-grid .card:nth-child(1) { -webkit-animation-delay: 0.1s; animation-delay: 0.1s; }
.main-grid .card:nth-child(2) { -webkit-animation-delay: 0.2s; animation-delay: 0.2s; }

.card h2 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    color: var(--text);
    position: relative;
}

.card h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--butter), var(--primary));
    border-radius: 2px;
}

/* ==========================================================================
   API Key Section
   ========================================================================== */

.api-key-section {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    -webkit-box-shadow: var(--shadow-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    -webkit-animation: fadeInUp 0.5s ease-out;
    -moz-animation: fadeInUp 0.5s ease-out;
    animation: fadeInUp 0.5s ease-out;
    border-left: 4px solid var(--butter);
}

.api-key-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.api-key-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: end;
}

.model-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    min-width: 200px;
    background: white;
    cursor: pointer;
}

.api-key-row {
    display: flex;
    gap: 0.75rem;
}

.api-key-row input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.api-key-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Cover Letter Fields
   ========================================================================== */

.cover-letter-fields {
    padding-left: 0.5rem;
    border-left: 3px solid var(--primary);
    margin-left: 0.25rem;
}

.cover-letter-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.cover-letter-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

/* ==========================================================================
   Upload Zone
   ========================================================================== */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(315deg, #f8f9fc 0%, #f1f5f9 100%);
    background: linear-gradient(135deg, #f8f9fc 0%, #f1f5f9 100%);
    position: relative;
    overflow: hidden;
}

.upload-zone::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: -webkit-linear-gradient(315deg, transparent 40%, rgba(255, 216, 89, 0.1) 100%);
    background: linear-gradient(135deg, transparent 40%, rgba(255, 216, 89, 0.1) 100%);
    opacity: 0;
    -webkit-transition: opacity 0.3s ease;
    -moz-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
}

.upload-zone:hover::after {
    opacity: 1;
}

.upload-zone:hover {
    border-color: var(--butter);
    background: -webkit-linear-gradient(315deg, #fefcf3 0%, #fff9e6 100%);
    background: linear-gradient(135deg, #fefcf3 0%, #fff9e6 100%);
    -webkit-transform: scale(1.01);
    -moz-transform: scale(1.01);
    transform: scale(1.01);
    -webkit-box-shadow: 0 0 20px rgba(255, 216, 89, 0.2);
    box-shadow: 0 0 20px rgba(255, 216, 89, 0.2);
}

.upload-zone.dragover {
    border-color: var(--butter);
    background: -webkit-linear-gradient(315deg, #fff9e6 0%, #fff3cc 100%);
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cc 100%);
    border-style: solid;
    -webkit-animation: pulse 1s ease-in-out infinite;
    -moz-animation: pulse 1s ease-in-out infinite;
    animation: pulse 1s ease-in-out infinite;
}

@-webkit-keyframes pulse {
    0%, 100% { -webkit-box-shadow: 0 0 0 0 rgba(255, 216, 89, 0.4); box-shadow: 0 0 0 0 rgba(255, 216, 89, 0.4); }
    50% { -webkit-box-shadow: 0 0 0 10px rgba(255, 216, 89, 0); box-shadow: 0 0 0 10px rgba(255, 216, 89, 0); }
}

@-moz-keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 216, 89, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 216, 89, 0); }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 216, 89, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 216, 89, 0); }
}

.upload-zone input {
    display: none;
}

.upload-icon {
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

.upload-icon svg {
    filter: drop-shadow(0 4px 8px rgba(91, 75, 138, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.upload-zone:hover .upload-icon svg {
    transform: translateY(-5px) scale(1.05);
    filter: drop-shadow(0 8px 16px rgba(255, 216, 89, 0.4));
}

/* ==========================================================================
   File Info
   ========================================================================== */

.file-info {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    border: 1px solid #bbf7d0;
}

.file-info .name {
    font-weight: 600;
    color: #166534;
}

.file-info .size {
    color: #15803d;
    font-size: 0.875rem;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

textarea {
    width: 100%;
    min-height: 300px;
    padding: 1.25rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    transition: all 0.2s ease;
    background: #fafafc;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: #ffffff;
}

textarea::placeholder {
    color: #94a3b8;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem !important;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: -webkit-linear-gradient(315deg, var(--primary) 0%, var(--primary-dark) 100%);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    -webkit-box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: -webkit-linear-gradient(left, transparent, rgba(255, 216, 89, 0.3), transparent);
    background: linear-gradient(90deg, transparent, rgba(255, 216, 89, 0.3), transparent);
    -webkit-transition: left 0.5s ease;
    -moz-transition: left 0.5s ease;
    transition: left 0.5s ease;
}

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

.btn-primary:hover {
    -webkit-transform: translateY(-3px);
    -moz-transform: translateY(-3px);
    transform: translateY(-3px);
    -webkit-box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5), 0 0 20px rgba(255, 216, 89, 0.4);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5), 0 0 20px rgba(255, 216, 89, 0.4);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 216, 89, 0.3), transparent);
    transition: left 0.5s ease;
}

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

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5), 0 0 15px rgba(255, 216, 89, 0.3);
}

.btn-outline {
    background: white;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   Main Action Buttons (Analyze/Optimize)
   ========================================================================== */

.main-action-buttons {
    text-align: center;
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-analyze-only {
    padding: 1.25rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 100px;
    border: 2px solid #FFD859;
    color: #5B4B8A;
    background: white;
    transition: all 0.3s ease;
}

.btn-analyze-only:hover {
    background: #fff9e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 216, 89, 0.4);
}

.btn-analyze-only svg {
    margin-right: 8px;
    vertical-align: middle;
}

.btn-analyze-optimize {
    padding: 1.25rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 100px;
    background: linear-gradient(135deg, #5B4B8A 0%, #6B4F9E 50%, #FFD859 100%);
    color: white;
    box-shadow: 0 8px 30px rgba(91, 75, 138, 0.4), 0 4px 15px rgba(255, 216, 89, 0.3);
    transition: all 0.3s ease;
}

.btn-analyze-optimize:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(91, 75, 138, 0.5), 0 6px 20px rgba(255, 216, 89, 0.4);
}

.btn-analyze-optimize svg {
    margin-right: 8px;
    vertical-align: middle;
}

/* ==========================================================================
   Results Section
   ========================================================================== */

.results-section {
    margin-top: 3rem;
    -webkit-animation: fadeInUp 0.5s ease;
    -moz-animation: fadeInUp 0.5s ease;
    animation: fadeInUp 0.5s ease;
}

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

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

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

/* ==========================================================================
   Score Card
   ========================================================================== */

.score-card {
    background: linear-gradient(135deg, #6B5B95 0%, #7B6BA5 40%, #8E7DB5 70%, #C9A86C 100%);
    color: white;
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(107, 91, 149, 0.35), 0 10px 30px rgba(201, 168, 108, 0.15);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.7s ease-out;
}

.score-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(201, 168, 108, 0.1) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(255,255,255,0.08) 0%, transparent 50%);
    animation: scoreShimmer 4s ease-in-out infinite;
}

@keyframes scoreShimmer {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(15%, 15%) rotate(5deg); }
}

.score-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
}

.score-item {
    text-align: center;
}

.score-item.projected .score-value {
    color: #34d399;
    text-shadow: 0 4px 20px rgba(52, 211, 153, 0.4);
}

.score-value {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.score-label {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-top: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    position: relative;
}

.score-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.arrow-icon {
    font-size: 2.5rem;
    animation: pulse-arrow 1.5s ease-in-out infinite;
}

@keyframes pulse-arrow {
    0%, 100% { transform: translateX(0); opacity: 0.8; }
    50% { transform: translateX(5px); opacity: 1; }
}

.score-improvement {
    font-size: 1.25rem;
    font-weight: 700;
    background: rgba(52, 211, 153, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    color: #34d399;
}

@media (max-width: 640px) {
    .score-comparison {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .score-arrow {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .arrow-icon {
        transform: rotate(90deg);
    }
    
    @keyframes pulse-arrow {
        0%, 100% { transform: rotate(90deg) translateX(0); opacity: 0.8; }
        50% { transform: rotate(90deg) translateX(5px); opacity: 1; }
    }
}

/* ==========================================================================
   Analysis Grid
   ========================================================================== */

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.analysis-card {
    background: var(--card);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out backwards;
}

.analysis-card:nth-child(1) { animation-delay: 0.1s; }
.analysis-card:nth-child(2) { animation-delay: 0.2s; }
.analysis-card:nth-child(3) { animation-delay: 0.3s; }

.analysis-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(255, 216, 89, 0.15);
}

.analysis-card h3 {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
}

.analysis-card h3 svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Keywords
   ========================================================================== */

.keyword-tag {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 100px;
    font-size: 0.85rem;
    margin: 0.3rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: tagFadeIn 0.4s ease-out backwards;
}

.keyword-tag:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.keyword-match {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border: 1px solid #86efac;
}

.keyword-match:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.keyword-missing {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.keyword-missing:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

@keyframes tagFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Suggestions
   ========================================================================== */

.suggestion-item {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--butter);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: slideInLeft 0.5s ease-out backwards;
}

.suggestion-item:nth-child(1) { animation-delay: 0.1s; }
.suggestion-item:nth-child(2) { animation-delay: 0.2s; }
.suggestion-item:nth-child(3) { animation-delay: 0.3s; }
.suggestion-item:nth-child(4) { animation-delay: 0.4s; }
.suggestion-item:nth-child(5) { animation-delay: 0.5s; }

.suggestion-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow), 0 0 15px rgba(255, 216, 89, 0.2);
    border-left-width: 6px;
}

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

/* ==========================================================================
   Resume Preview
   ========================================================================== */

.updated-resume-section {
    margin-top: 2rem;
}

.cover-letter-section {
    margin-top: 2rem;
}

.resume-preview {
    background: linear-gradient(135deg, #fafafc 0%, #f5f5f7 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    line-height: 1.9;
    font-size: 1rem;
}

.cover-letter-preview {
    background: linear-gradient(135deg, #fafafc 0%, #f5f5f7 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    line-height: 1.9;
    font-size: 1rem;
    color: #1e293b;
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.25rem;
    gap: 0.5rem;
}

.tab {
    padding: 0.875rem 1.75rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s ease;
    border-radius: 8px 8px 0 0;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text);
    background: #f8fafc;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--butter);
    background: linear-gradient(180deg, rgba(255, 216, 89, 0.15) 0%, transparent 100%);
}

/* ==========================================================================
   Diff Section
   ========================================================================== */

.diff-section {
    margin-top: 1.25rem;
}

.diff-item {
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    background: #fafafa;
    transition: transform 0.2s ease;
}

.diff-item:hover {
    transform: translateX(3px);
}

.diff-original {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    text-decoration: line-through;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.diff-updated {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.diff-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.9rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.status-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* ==========================================================================
   Loading & Error States
   ========================================================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    background: var(--card);
    border-radius: 20px;
    margin-top: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--butter);
    border-right-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 20px rgba(255, 216, 89, 0.3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-left: 1.25rem;
    color: var(--text);
    font-weight: 500;
    font-size: 1.1rem;
}

.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    color: #991b1b;
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    font-weight: 500;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
    text-align: center;
    padding: 2.5rem 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

footer p {
    background: -webkit-linear-gradient(315deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 216, 89, 0.1) 100%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 216, 89, 0.1) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 100px;
    display: inline-block;
    border: 1px solid rgba(255, 216, 89, 0.2);
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

footer p:hover {
    background: -webkit-linear-gradient(315deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 216, 89, 0.15) 100%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 216, 89, 0.15) 100%);
    border-color: rgba(255, 216, 89, 0.4);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
    display: none !important;
}

/* ==========================================================================
   Mobile Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    header {
        margin-bottom: 1.5rem;
        padding: 0.5rem 0;
    }
    
    .logo-container svg {
        width: 70px;
        height: 70px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    /* API Key Section Mobile */
    .api-key-section {
        padding: 1rem 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .api-key-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .api-key-row {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .api-key-row input {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .model-select {
        width: 100%;
        min-width: unset;
    }
    
    /* Cards Mobile */
    .card {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .card h2 {
        font-size: 1.15rem;
        gap: 0.5rem;
    }
    
    .card h2 svg {
        width: 24px;
        height: 24px;
    }
    
    /* Upload Zone Mobile */
    .upload-zone {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
    
    .upload-zone .upload-icon svg {
        width: 48px;
        height: 48px;
    }
    
    /* Textarea Mobile */
    textarea {
        min-height: 200px;
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    /* Action Buttons Mobile */
    .action-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    /* Main action buttons */
    .main-action-buttons {
        flex-direction: column;
        margin: 1.5rem 0;
    }
    
    .btn-analyze-only,
    .btn-analyze-optimize {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }
    
    /* Cover Letter Fields Mobile */
    .cover-letter-inputs-row {
        grid-template-columns: 1fr;
    }
    
    .cover-letter-input {
        font-size: 0.9rem;
    }
    
    /* Results Section Mobile */
    .score-card {
        padding: 2rem 1.25rem;
        border-radius: 16px;
    }
    
    .score-value {
        font-size: 3rem;
    }
    
    .score-label {
        font-size: 0.95rem;
    }
    
    /* Analysis Grid Mobile */
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .analysis-card {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .analysis-card h3 {
        font-size: 1rem;
    }
    
    /* Resume Preview Mobile */
    .resume-preview,
    .cover-letter-preview {
        padding: 1.25rem;
        font-size: 0.9rem;
        max-height: 350px;
    }
    
    /* Tabs Mobile */
    .tabs {
        gap: 0.25rem;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* File Info Mobile */
    .file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .file-info button {
        width: 100%;
    }
    
    /* Footer Mobile */
    footer {
        padding: 1.5rem 1rem;
    }
    
    footer p {
        padding: 0.75rem 1.25rem;
        font-size: 0.8rem;
    }
    
    /* Loading Mobile */
    .loading {
        padding: 2.5rem 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .loading-text {
        margin-left: 0;
        margin-top: 1rem;
    }
    
    /* Buttons Mobile */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    /* Touch target improvements */
    .btn-outline {
        min-height: 44px;
    }
    
    input[type="text"],
    input[type="checkbox"],
    select,
    textarea {
        min-height: 44px;
    }
    
    .tab {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .logo-container svg {
        width: 60px;
        height: 60px;
    }
    
    .api-key-section {
        padding: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .upload-zone {
        padding: 1.25rem 0.75rem;
    }
    
    .upload-zone p strong {
        font-size: 0.95rem;
    }
    
    textarea {
        min-height: 180px;
        font-size: 0.85rem;
    }
    
    .score-card {
        padding: 1.5rem 1rem;
    }
    
    .score-value {
        font-size: 2.5rem;
    }
    
    .score-improvement {
        font-size: 1rem;
    }
    
    .keyword-tag {
        padding: 0.3rem 0.7rem;
        font-size: 0.8rem;
        margin: 0.2rem;
    }
    
    .suggestion-item {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 5px;
    border: 2px solid #e2e8f0;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Scrollbar for textareas specifically */
textarea::-webkit-scrollbar {
    width: 10px;
}

textarea::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 0 12px 12px 0;
}

textarea::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 5px;
    border: 2px solid #e2e8f0;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
