/* ========================================
   BASE STYLES
   ======================================== */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    transition: background-color 0.2s ease, color 0.2s ease;
    overflow-x: hidden;
}

:focus-visible {
    outline: 2px solid #002B49;
    outline-offset: 2px;
    border-radius: 4px;
}
.dark :focus-visible {
    outline-color: #60a5fa;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 12px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

/* ========================================
   NAVIGATION
   ======================================== */
.glass-nav {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}
.dark .glass-nav {
    background: rgba(2, 6, 23, 0.8);
    border-bottom: 1px solid #1e2a3a;
}

/* ========================================
   CARDS
   ======================================== */
.modern-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .modern-card {
    background: #0f172a;
    border-color: rgba(30, 41, 59, 0.8);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
}
.modern-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
}
.dark .modern-card:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-black {
    background: #000000;
    color: #ffffff;
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}
.dark .btn-black {
    background: #f8fafc;
    color: #020617;
}
.btn-black:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.15);
}
.btn-black:active:not(:disabled) {
    transform: scale(0.97);
}
.btn-black:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-generating {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    animation: gradientShift 1.5s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-coffee {
    background: linear-gradient(135deg, #FFD166 0%, #F4A261 100%);
    transition: all 0.3s ease;
}
.btn-coffee:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}
.dark .btn-coffee {
    background: linear-gradient(135deg, #F4A261 0%, #E76F51 100%);
}

.copy-btn-light {
    background: #f1f5f9;
    color: #475569;
    transition: all 0.2s ease;
}
.copy-btn-light:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}
.dark .copy-btn-light {
    background: #334155;
    color: #cbd5e1;
}
.dark .copy-btn-light:hover {
    background: #475569;
    color: #f8fafc;
}

.copy-success {
    background-color: #10b981 !important;
    color: white !important;
    animation: copyFlash 0.5s ease;
}
@keyframes copyFlash {
    0% { background: #10b98120; }
    100% { background: transparent; }
}

/* ========================================
   GENERATOR: OPTION PILLS & INPUTS
   ======================================== */
.pill-btn, .option-pill {
    padding: 0.5rem 1.25rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pill-btn:hover, .option-pill:hover {
    border-color: #3B82F6;
    color: #0F172A;
}
.pill-btn.selected {
    background: #0F172A;
    color: white;
    border-color: #0F172A;
}
.option-pill.selected {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.08);
}
.option-pill.other-trigger {
    border-style: dashed;
}

/* Dark Mode: Generator Pills */
.dark .pill-btn, .dark .option-pill {
    border-color: #334155;
    color: #94a3b8;
}
.dark .pill-btn:hover, .dark .option-pill:hover {
    border-color: #3B82F6;
    color: #e2e8f0;
}
.dark .pill-btn.selected {
    background: #f8fafc;
    color: #0F172A;
    border-color: #f8fafc;
}
.dark .option-pill.selected {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.15);
}

.other-input-container {
    animation: slideDown 0.2s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   TYPE PILLS (Legacy/Alternative)
   ======================================== */
.type-pill {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.dark .type-pill {
    background: #1e293b;
    border-color: #334155;
}
input[type="radio"]:checked+.type-pill {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.3);
    transform: scale(1.02);
}
.dark input[type="radio"]:checked+.type-pill {
    background: #f8fafc;
    color: #0f172a;
    border-color: #f8fafc;
    box-shadow: 0 10px 20px -5px rgba(248, 250, 252, 0.2);
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
textarea,
input {
    font-size: 16px !important;
}
textarea {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
    transition: all 0.2s ease;
}
textarea:focus {
    transform: translateY(-2px);
}

/* ========================================
   FAQ
   ======================================== */
.faq-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem 0;
}
.dark .faq-item {
    border-color: rgba(255, 255, 255, 0.05);
}

/* ========================================
   SKELETON LOADER
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}
.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   SPINNER
   ======================================== */
.spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   PROGRESS
   ======================================== */
.progress-container {
    background: #1e293b;
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.progress-fill {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(90deg, #10b981, #34d399, #059669);
    background-size: 200% 100%;
    animation: progressShimmer 1s ease infinite;
}
@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   RESULT PANEL
   ======================================== */
.result-panel-light {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.08);
}
.dark .result-panel-light {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.3);
}
.result-header-light {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.dark .result-header-light {
    background: #1e293b;
    border-bottom-color: #334155;
}
.result-footer-light {
    background: #fafcff;
    border-top: 1px solid #eef2ff;
}
.dark .result-footer-light {
    background: #0f172a;
    border-top-color: #1e293b;
}
.result-stat-light {
    background: #f1f5f9;
    color: #0f172a;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
}
.dark .result-stat-light {
    background: #334155;
    color: #e2e8f0;
}
.result-stat-green {
    background: #ecfdf5;
    color: #059669;
}
.dark .result-stat-green {
    background: #064e3b;
    color: #34d399;
}
.generated-text {
    color: #1e293b;
    line-height: 1.6;
}
.dark .generated-text {
    color: #e2e8f0;
}

/* ========================================
   BRITISH TIP
   ======================================== */
.brit-tip {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0284c7;
}
.dark .brit-tip {
    background: linear-gradient(135deg, #0c4a6e20 0%, #0284c720 100%);
    border-left-color: #38bdf8;
}

/* ========================================
   EXAMPLE CARDS
   ======================================== */
.example-card {
    cursor: pointer;
    transition: all 0.2s ease;
}
.example-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   FOOTER LINKS
   ======================================== */
.footer-link {
    color: #64748b;
    transition: color 0.2s ease;
}
.footer-link:hover {
    color: #0f172a;
}
.dark .footer-link:hover {
    color: #e2e8f0;
}

/* ========================================
   STEP DOTS (CV Builder)
   ======================================== */
.step-card {
    display: none;
}
.step-card.active {
    display: block;
    animation: fadeIn 0.35s ease;
}

.step-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s;
    flex-shrink: 0;
}
.step-dot.active {
    background: #002B49;
    color: white;
}
.step-dot.done {
    background: #10b981;
    color: white;
}
.step-dot.inactive {
    background: #e5e7eb;
    color: #9ca3af;
}

.step-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    transition: background 0.3s;
    min-width: 20px;
}
.step-line.done {
    background: #10b981;
}

/* ========================================
   TOC LINKS (Guide)
   ======================================== */
.toc-link {
    transition: all 0.2s ease;
}
.toc-link:hover {
    padding-left: 6px;
    color: #10b981;
}

.back-to-top {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}
.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ========================================
   CHARACTER ANIMATION
   ======================================== */
.character-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    animation: fadeIn 0.3s ease;
    display: none;
}
.dark .character-container {
    background: #0f172a;
    border-color: #1e293b;
}

.character-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.character-display {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    overflow: hidden;
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
    position: relative;
}
.dark .character-display {
    background: #0f172a;
}

.character-video,
.character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.speech-bubble-container {
    max-width: 400px;
    width: 100%;
    padding: 0 1rem;
}

.speech-bubble {
    position: relative;
    background: #f1f5f9;
    border-radius: 1rem;
    padding: 0.75rem 1.5rem;
    text-align: center;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dark .speech-bubble {
    background: #1e293b;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-bottom-color: #f1f5f9;
}
.dark .speech-bubble::before {
    border-bottom-color: #1e293b;
}

.character-message {
    font-size: 1rem;
    font-weight: 500;
    color: #334155;
    line-height: 1.4;
}
.dark .character-message {
    color: #e2e8f0;
}

.character-progress {
    width: 100%;
    max-width: 400px;
}

.character-progress .progress-track {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}
.dark .character-progress .progress-track {
    background: #334155;
}

.character-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #22C55E);
    border-radius: 9999px;
    transition: width 0.3s ease;
    width: 0%;
}

.character-progress .progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.character-progress .progress-timer {
    font-family: monospace;
}

.character-container.hidden {
    display: none !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { transform: scale(0.96); }
    to { transform: scale(1); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}
.animate-scale-in {
    animation: scaleIn 0.2s ease;
}
.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
    .character-display {
        width: 200px;
        height: 200px;
    }
    .speech-bubble {
        padding: 0.5rem 1rem;
        min-height: 2.5rem;
    }
    .character-message {
        font-size: 0.875rem;
    }
}

/* ========================================
   MISC HELPERS
   ======================================== */
.hidden {
    display: none !important;
}

.cursor-blink::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    color: #10b981;
    margin-left: 2px;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}