/* ===============================================
   RESUME BUILDER - BRIGHT THEME (COMPREHENSIVE FIXES)
   Fixed: Header positioning, Tab visibility, Button sizing, Template styling
   =============================================== */

/* ===== CSS VARIABLES (ORIGINAL BRIGHT THEME) ===== */
:root {
    /* Brand Colors */
    --primary-color: #ff7e5f;
    --primary-dark: #e6654a;
    --primary-light: #ff9478;
    --secondary-color: #6ec1e4;
    --accent-color: #4b8be1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* Enhanced Brand Gradients */
    --gradient-primary: linear-gradient(135deg, #ff7e5f 0%, #6ec1e4 100%);
    --gradient-secondary: linear-gradient(135deg, #6ec1e4 0%, #4b8be1 100%);
    --gradient-accent: linear-gradient(135deg, #ff9478 0%, #7ecce7 100%);
    --gradient-elegant: linear-gradient(135deg, #ff7e5f 0%, #feb47b 25%, #6ec1e4 75%, #4b8be1 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(255, 126, 95, 0.08) 0%, rgba(110, 193, 228, 0.08) 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    --gradient-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.05) 100%);
    
    /* Enhanced Color Palette */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Enhanced Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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-brand: 0 10px 40px rgba(255, 126, 95, 0.15), 0 4px 15px rgba(110, 193, 228, 0.1);
    --shadow-elegant: 0 20px 60px rgba(255, 126, 95, 0.12), 0 8px 30px rgba(110, 193, 228, 0.08);
    
    /* Design Variables */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --backdrop-blur: backdrop-filter: blur(20px);
    
    /* Z-index Scale */
    --z-header: 100;
    --z-dropdown: 200;
    --z-sticky: 300;
    --z-modal: 1000;
    --z-toast: 1100;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-900);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

body.modal-open {
    overflow: hidden;
}

/* ===== FIXED HEADER COMPONENT ===== */
.builder-header {
    background: var(--gradient-elegant);
    border: none;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    box-shadow: 0 8px 32px rgba(255, 126, 95, 0.25), 0 4px 20px rgba(110, 193, 228, 0.15);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: env(safe-area-inset-top, 0);
}

/* FIXED: Header Content Layout */
.header-content {
    max-width: 100%;
    padding: 0 24px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

/* FIXED: Logo Styling */
.header-left h1,
.header-left .logo {
    font-size: 1.625rem;
    font-weight: 700;
    color: #ff7e5f;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.025em;
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
}

/* FIXED: Header Center - Tabs Container */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* FIXED: Smaller header buttons like the tabs */
.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px; /* Smaller like tabs */
    border-radius: 25px; /* More rounded like tabs */
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem; /* Smaller font */
    font-weight: 500;
    text-decoration: none;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.ats-score-badge {
    display: flex;
    align-items: center;
    gap: 8px; /* Smaller gap */
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 8px 16px; /* Smaller padding like tabs */
    border-radius: 25px; /* More rounded */
    font-size: 0.8rem; /* Smaller font */
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.ats-score-badge i {
    font-size: 0.8rem; /* Smaller icon */
}

/* ===== MAIN LAYOUT ===== */
.builder-container {
    display: flex;
    height: calc(100vh - 80px);
    overflow: hidden;
}

@supports (height: 100dvh) {
    .builder-container {
        height: calc(100dvh - 80px);
    }
}

/* ===== LEFT PANEL (BUILDER) ===== */
.builder-panel {
    width: 480px;
    background: var(--gradient-card);
    border-right: 1px solid rgba(255, 126, 95, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 4px 0 20px rgba(255, 126, 95, 0.08);
}

/* FIXED: RESTORE panel header - show the tabs */
.panel-header {
    display: block !important;
    background: var(--gradient-subtle);
    border-bottom: 1px solid rgba(255, 126, 95, 0.15);
    padding: 20px 28px;
}

/* FIXED: Panel Tabs - now visible in left panel */
.panel-tabs {
    display: flex !important;
    background: rgba(255, 126, 95, 0.15);
    border-radius: 50px;
    padding: 4px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 126, 95, 0.2);
    box-shadow: 0 4px 20px rgba(255, 126, 95, 0.1);
    justify-content: center;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: none;
    border: none;
    color: rgba(255, 126, 95, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 50px;
    min-width: 100px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 126, 95, 0.15);
}

.tab-btn.active {
    color: white;
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px rgba(255, 126, 95, 0.3);
    font-weight: 600;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    display: none;
    padding: 24px 28px 0 28px; /* Reduced top padding since panel header is now visible */
    scroll-behavior: smooth;
    position: relative;
    min-height: 320px;
}

.tab-content.active {
    display: block;
}

/* Enhanced scrollbar */
.tab-content::-webkit-scrollbar {
    width: 12px;
}

.tab-content::-webkit-scrollbar-track {
    background: rgba(255, 126, 95, 0.08);
    border-radius: 6px;
    margin: 8px 0;
}

.tab-content::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-accent);
    background-clip: content-box;
}

/* ===== FORM COMPONENTS ===== */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding-bottom: 120px;
    min-height: calc(100vh - 200px);
}

.form-section {
    background: var(--gradient-card);
    border: 1px solid rgba(255, 126, 95, 0.2);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-brand);
    transition: var(--transition);
    position: relative;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.form-section:hover {
    border-color: rgba(255, 126, 95, 0.3);
    box-shadow: var(--shadow-elegant);
    transform: translateY(-4px);
}

.form-section:hover::before {
    opacity: 1;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
    background: var(--gradient-subtle);
    border-bottom: 1px solid rgba(255, 126, 95, 0.15);
    cursor: pointer;
    transition: var(--transition);
}

.section-header:hover {
    background: linear-gradient(135deg, rgba(255, 126, 95, 0.12) 0%, rgba(110, 193, 228, 0.12) 100%);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.025em;
}

.section-header h3 i {
    color: var(--primary-color);
    width: 20px;
    font-size: 1.125rem;
}

.section-content {
    padding: 32px 28px;
    transition: var(--transition);
}

.section-content.collapsed {
    display: none;
}

/* Form Controls */
.form-row {
    display: flex;
    gap: 18px;
    margin-bottom: 22px;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    letter-spacing: 0.025em;
}

/* RESPONSIVE INPUT STYLES */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="month"],
input[type="date"],
input[type="color"],
select,
textarea {
    width: 100%;
    /* Desktop - Bigger inputs */
    padding: 18px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255, 126, 95, 0.25);
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-weight: 500;
    color: var(--gray-900);
}

/* Date inputs - smaller and more compact */
input[type="month"],
input[type="date"] {
    padding: 8px 12px;
    font-size: 0.75rem;
    min-height: 32px;
    max-width: 140px;
    color-scheme: light;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 126, 95, 0.15), 0 4px 12px rgba(255, 126, 95, 0.1);
    background: white;
    transform: translateY(-2px);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
    font-style: italic;
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    margin-top: 10px;
    padding: 10px 0;
    transition: var(--transition-fast);
}

.checkbox-label:hover {
    color: var(--primary-color);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 8px;
    font-weight: 500;
}

/* ===== ENHANCED BUTTON COMPONENTS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
}

.btn::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 0.6s ease;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.4), 0 2px 10px rgba(110, 193, 228, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 126, 95, 0.5), 0 4px 15px rgba(110, 193, 228, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border: 1px solid rgba(255, 126, 95, 0.3);
    backdrop-filter: blur(15px);
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.25);
}

/* FIXED: Smaller Add Buttons */
.btn-add {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 20px; /* Smaller radius */
    padding: 8px 16px; /* Much smaller padding */
    font-size: 0.75rem; /* Smaller font */
    font-weight: 600; /* Less bold */
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px; /* Smaller gap */
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); /* Softer shadow */
    letter-spacing: 0.25px; /* Less spacing */
    text-transform: none; /* Remove uppercase */
    position: relative;
    overflow: hidden;
    max-width: 140px; /* Limit width */
}

.btn-add::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.4s ease, height 0.4s ease;
}

.btn-add:hover::after {
    width: 200px;
    height: 200px;
}

.btn-add:hover {
    transform: translateY(-2px) scale(1.02); /* Less dramatic hover */
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

/* FLASHY AI Buttons (Bright Theme) */
.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ai::before {
    content: '✨';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.8) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

.btn-ai:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

.btn-collapse {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-collapse:hover {
    background: rgba(255, 126, 95, 0.15);
    transform: scale(1.1);
}

.btn-collapse.collapsed i {
    transform: rotate(-90deg);
}

/* Button Focus States */
.btn:focus-visible,
.tab-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== SKILLS COMPONENT (FIXED LUMPING) ===== */
.skills-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.skills-input-container input {
    flex: 1;
}

.btn-add-skill {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(75, 139, 225, 0.3);
}

.btn-add-skill:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(75, 139, 225, 0.4);
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 60px;
    padding: 18px;
    border: 2px dashed rgba(255, 126, 95, 0.3);
    border-radius: var(--border-radius);
    background: var(--gradient-subtle);
    transition: var(--transition);
}

.skills-container:hover {
    border-color: rgba(255, 126, 95, 0.5);
    background: rgba(255, 126, 95, 0.08);
}

.skills-container:empty::before {
    content: "Add skills by typing above and pressing Enter...";
    color: var(--gray-400);
    font-style: italic;
    font-size: 0.875rem;
}

/* FIXED: Proper skill tag spacing */
.skill-tag {
    display: inline-flex;
    align-items: center;
    background: var(--gradient-primary);
    border: none;
    border-radius: 25px;
    padding: 8px 16px;
    margin: 6px;
    font-size: 0.875rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 126, 95, 0.35);
    transition: var(--transition);
    letter-spacing: 0.025em;
    /* FIXED: Ensure proper spacing and no lumping */
    white-space: nowrap;
    line-height: 1.2;
}

.skill-tag:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.45);
}

.skill-tag .btn-remove-skill {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: white;
    cursor: pointer;
    margin-left: 10px;
    padding: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.skill-tag .btn-remove-skill:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
}

/* ===== ADDITIONAL SECTIONS ===== */
.additional-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.btn-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 22px 18px;
    background: var(--gradient-card);
    border: 2px solid rgba(255, 126, 95, 0.2);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    backdrop-filter: blur(15px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-subtle);
    transition: left 0.5s ease;
}

.btn-section:hover::before {
    left: 0;
}

.btn-section:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-brand);
}

.btn-section:active {
    transform: translateY(-3px) scale(1.01);
}

.btn-section i {
    font-size: 1.625rem;
    color: var(--primary-color);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

/* ===== TEMPLATES COMPONENT ===== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* ===== DESIGN TAB - COLOR CONTROLS ===== */
.design-controls {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding-bottom: 60px;
}

.design-section {
    background: var(--gradient-card);
    border: 1px solid rgba(255, 126, 95, 0.2);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-brand);
}

.design-section h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 20px;
}

.design-section h4 i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.color-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.color-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* FIXED: Color input styling */
input[type="color"] {
    width: 60px !important;
    height: 60px !important;
    border: 3px solid rgba(255, 126, 95, 0.3);
    border-radius: 12px;
    cursor: pointer;
    background: none;
    padding: 0;
    overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 8px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 8px;
}

input[type="color"]:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 126, 95, 0.3);
}

.color-presets {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.color-preset {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.color-preset.active {
    border-color: var(--primary-color);
    border-width: 3px;
    transform: scale(1.05);
}

.typography-controls,
.layout-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    user-select: none;
    pointer-events: auto;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.template-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.25);
    transform: translateY(-2px);
}

.template-card.active::before {
    content: '✓';
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.template-preview {
    height: 120px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e5e7eb;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.template-info {
    padding: 15px;
    pointer-events: none;
}

.template-info h4 {
    margin: 0 0 8px 0;
    color: #1a202c;
    font-weight: 600;
    font-size: 14px;
}

.template-info p {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.template-features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    pointer-events: none;
}

.feature-tag {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 500;
    display: inline-block;
}

/* ===== RIGHT PANEL (PREVIEW - KEEP BRIGHT) ===== */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(110, 193, 228, 0.08) 0%, rgba(255, 126, 95, 0.05) 100%);
    overflow: hidden;
}

.preview-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(255, 126, 95, 0.15);
    padding: 18px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(255, 126, 95, 0.08);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.preview-controls {
    display: flex;
    gap: 10px;
}

.btn-preview-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 126, 95, 0.25);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-600);
    backdrop-filter: blur(15px);
}

.btn-preview-toggle:hover {
    background: rgba(255, 126, 95, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.25);
}

.btn-preview-toggle.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(255, 126, 95, 0.35);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 10px 20px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 126, 95, 0.25);
    box-shadow: 0 4px 15px rgba(255, 126, 95, 0.1);
    z-index: 100;
}

.zoom-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 126, 95, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    color: var(--primary-color);
}

.zoom-controls button:hover {
    background: var(--gradient-subtle);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.zoom-controls span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    min-width: 70px;
    text-align: center;
}

.preview-container {
    flex: 1;
    overflow: auto;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.resume-preview {
    transform-origin: top center;
    transition: transform 0.4s ease;
    filter: drop-shadow(0 15px 50px rgba(255, 126, 95, 0.2));
    /* ENSURE BRIGHT PREVIEW */
    background: white !important;
    color: var(--gray-900) !important;
}

/* ===== EXPORT DROPDOWN - FIXED WIDTH ===== */
.export-dropdown {
    position: relative;
}

.export-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0; /* Changed from 16px */
    background: var(--gradient-card);
    border: 1px solid rgba(255, 126, 95, 0.2);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-elegant);
    min-width: 180px; /* Increased from 200px */
    width: 200px; /* Fixed width */
    max-width: calc(100vw - 32px);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: var(--transition);
    backdrop-filter: blur(20px);
}

.export-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.export-menu button {
    display: flex;
    align-items: center;
    gap: 12px; /* Reduced gap */
    width: 100%;
    padding: 12px 16px; /* Adjusted padding */
    background: none;
    border: none;
    text-align: left;
    font-size: 0.85rem; /* Slightly larger font */
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.export-menu button:hover {
    background: var(--gradient-subtle);
    color: var(--primary-color);
    transform: translateX(4px);
}

.export-menu button:first-child {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.export-menu button:last-child {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.export-menu button:not(:last-child) {
    border-bottom: 1px solid rgba(255, 126, 95, 0.1);
}

/* ===== ATS PANEL (FIXED) ===== */
.ats-panel {
    position: fixed;
    right: -450px;
    top: 80px;
    width: 420px;
    height: calc(100vh - 80px);
    background: var(--gradient-card);
    border-left: 1px solid rgba(255, 126, 95, 0.2);
    z-index: 999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(255, 126, 95, 0.15);
    backdrop-filter: blur(20px);
}

.ats-panel.active {
    right: 0;
}

.ats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255, 126, 95, 0.15);
    background: var(--gradient-subtle);
}

.ats-header h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.025em;
}

.ats-header h4 i {
    color: var(--primary-color);
    font-size: 1.375rem;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 126, 95, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.btn-close:hover {
    background: rgba(255, 126, 95, 0.2);
    transform: scale(1.1);
}

.ats-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

.ats-score-circle {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.score-ring {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(
        var(--success-color) 0deg 306deg,
        var(--gray-200) 306deg 360deg
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.2);
}

.score-ring::before {
    content: '';
    position: absolute;
    width: 110px;
    height: 110px;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--gray-900);
    z-index: 1;
    letter-spacing: -0.025em;
}

.score-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    z-index: 1;
    font-weight: 500;
}

.ats-suggestions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== FOOTER COMPONENT ===== */
.content-footer {
    margin-top: 40px;
    padding: 32px 0 calc(60px + env(safe-area-inset-bottom, 0)) 0;
    border-top: 2px solid rgba(255, 126, 95, 0.15);
    background: var(--gradient-subtle);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    text-align: center;
    position: relative;
}

.content-footer::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.footer-content {
    max-width: 320px;
    margin: 0 auto;
}

.footer-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.footer-content h4 i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.footer-content p {
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.footer-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-footer {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    border: 1px solid rgba(255, 126, 95, 0.3);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-footer:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 126, 95, 0.2);
}

/* ===== FLOATING ELEMENTS ===== */
.floating-actions {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom, 0));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.floating-actions.visible {
    opacity: 1;
    visibility: visible;
}

.btn-floating {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(255, 126, 95, 0.3);
    font-size: 1.125rem;
    will-change: transform;
    backface-visibility: hidden;
}

.btn-floating:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 126, 95, 0.5);
}

.btn-floating.save {
    background: var(--gradient-secondary);
    box-shadow: 0 4px 20px rgba(75, 139, 225, 0.3);
}

.btn-floating.save:hover {
    box-shadow: 0 8px 30px rgba(75, 139, 225, 0.5);
}

.scroll-progress {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0));
    right: calc(20px + env(safe-area-inset-right, 0));
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(255, 126, 95, 0.3);
    cursor: pointer;
    transition: var(--transition);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.scroll-progress.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.scroll-progress:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 126, 95, 0.4);
}

/* ===== NOTIFICATION SYSTEM ===== */
#toastHost {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0));
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 480px);
    z-index: var(--z-toast);
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.notification {
    pointer-events: auto;
    border-radius: 10px;
    padding: 10px 14px;
    background: #111;
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

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

.notification-success {
    background: #0f766e;
}

.notification-error {
    background: #b91c1c;
}

.notification-warning {
    background: #b45309;
}

.notification-info {
    background: #1f2937;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-content i {
    font-size: 16px;
}

/* ===== RESUME TEMPLATE FIXES (SKILLS SPACING + ORANGE LINES) ===== */

/* CRITICAL: Fix skill lumping in all resume templates */
.resume-preview .skills-grid,
.resume-preview .skills-container,
.resume-preview .core-competencies,
.resume-preview .skill-list,
.resume-preview [class*="skill"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 12px !important;
    line-height: 1.6 !important;
    align-items: flex-start !important;
}

.resume-preview .skill-item,
.resume-preview .skill,
.resume-preview [class*="skill-"]:not(.skills-) {
    display: inline-block !important;
    margin: 4px 6px !important;
    padding: 6px 12px !important;
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    border-radius: 16px !important;
    font-size: 0.85rem !important;
    color: #495057 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Ensure proper spacing in all templates */
.resume-preview .skills-section {
    margin-bottom: 20px !important;
}

.resume-preview .skills-section .section-content {
    padding: 16px !important;
}

/* Force bright background for resume preview */
.resume-preview,
.resume-preview * {
    background-color: white !important;
    color: var(--gray-900) !important;
}

.resume-preview .section-title,
.resume-preview h1,
.resume-preview h2,
.resume-preview h3,
.resume-preview h4 {
    color: var(--gray-900) !important;
}

/* FIXED: ORANGE THEME LINES IN RESUME PREVIEW SECTIONS */
.resume-preview .section-divider,
.resume-preview .section-separator,
.resume-preview .divider,
.resume-preview hr,
.resume-preview .section-line,
.resume-preview .section-border,
.resume-preview [class*="line"],
.resume-preview [class*="border"] {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    background-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

/* Specific template styling fixes */

/* Modern Clean Template */
.resume-preview[data-template="modern"] .section-title::after,
.resume-preview.modern .section-title::after {
    background: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
}

/* Executive Template */
.resume-preview[data-template="executive"] .section-header,
.resume-preview.executive .section-header,
.resume-preview[data-template="executive"] .header-line,
.resume-preview.executive .header-line {
    border-bottom: 3px solid var(--primary-color) !important;
    background: linear-gradient(to right, var(--primary-color), rgba(255, 126, 95, 0.3)) !important;
}

/* Creative Template */
.resume-preview[data-template="creative"] .accent-line,
.resume-preview.creative .accent-line,
.resume-preview[data-template="creative"] .section-accent,
.resume-preview.creative .section-accent {
    background: var(--gradient-primary) !important;
    border-left: 4px solid var(--primary-color) !important;
}

/* Classic Professional Template */
.resume-preview[data-template="classic"] .section-border,
.resume-preview.classic .section-border {
    border-bottom: 1px solid var(--primary-color) !important;
}

/* Minimalist Template - keep as is since it's fine */
.resume-preview[data-template="minimalist"] .section-line,
.resume-preview.minimalist .section-line {
    background: var(--primary-color) !important;
    height: 1px !important;
}

/* Universal section styling for all templates */
.resume-preview .section-title {
    border-bottom: 2px solid var(--primary-color) !important;
    color: var(--gray-900) !important;
}

.resume-preview .profile-section,
.resume-preview .experience-section,
.resume-preview .education-section,
.resume-preview .skills-section {
    border-bottom: 1px solid rgba(255, 126, 95, 0.3) !important;
    margin-bottom: 20px !important;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Large screens */
@media (min-width: 1024px) {
    #toastHost {
        left: auto;
        right: 18px;
        transform: none;
        width: auto;
    }
    
    /* Bigger inputs on desktop */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        padding: 20px 24px;
        font-size: 1.1rem;
    }
}

/* Medium screens - header adjustments */
@media (max-width: 1200px) {
    .header-content {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 24px;
    }
    
    .header-center {
        order: 3;
        flex-basis: 100%;
        margin-top: 12px;
    }
    
    .panel-tabs {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }
}

/* Tablet responsive */
@media (max-width: 1024px) {
    .builder-container {
        flex-direction: column;
        height: calc(100vh - 80px);
    }
    
    .builder-panel {
        width: 100%;
        height: 35vh;
        border-right: none;
        border-bottom: 1px solid rgba(255, 126, 95, 0.15);
        flex-shrink: 0;
    }
    
    .preview-panel {
        height: 65vh;
        flex: 1;
        min-height: 0;
    }
    
    .tab-content {
        max-height: calc(35vh - 80px); /* Account for panel header */
        padding-bottom: max(60px, env(safe-area-inset-bottom, 24px));
    }
}

/* Support for dynamic viewport on mobile */
@supports (height: 100dvh) {
    @media (max-width: 1024px) {
        .builder-container {
            height: calc(100dvh - 80px) !important;
        }
        
        .builder-panel {
            height: 35dvh !important;
        }
        
        .preview-panel {
            height: 65dvh !important;
        }
    }
    
    @media (max-width: 768px) {
        .builder-container {
            height: calc(100dvh - 70px) !important;
        }
        
        .builder-panel {
            height: 30dvh !important;
        }
        
        .preview-panel {
            height: 70dvh !important;
        }
        
        .tab-content {
            max-height: calc(30dvh - 80px) !important;
        }
    }
}

/* Mobile responsive - FIXED HEADER */
@media (max-width: 768px) {
    .builder-header {
        padding-top: env(safe-area-inset-top, 0);
    }
    
    /* FIXED: Single row header on mobile */
    .header-content {
        padding: 8px 12px;
        height: 60px; /* Reduced height */
        flex-direction: row; /* Keep horizontal */
        gap: 6px;
        align-items: center;
        justify-content: space-between;
    }
    
    .header-left {
        gap: 8px;
        order: 1;
        flex-shrink: 1;
    }
    
    .header-left h1,
    .header-left .logo {
        font-size: 1.1rem; /* Smaller logo */
    }
    
    /* HIDE header center on mobile to save space */
    .header-center {
        display: none;
    }
    
    /* FIXED: Panel tabs on mobile */
    .panel-header {
        padding: 12px 18px;
    }
    
    .panel-tabs {
        width: 100%;
        padding: 2px;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        min-width: auto;
        gap: 4px;
        flex: 1;
    }
    
    .tab-btn i {
        font-size: 0.7rem;
    }
    
    .header-right {
        order: 3;
        gap: 4px; /* Smaller gap */
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }
    
    /* MUCH smaller header buttons on mobile */
    .btn-back {
        padding: 4px 8px; /* Much smaller */
        font-size: 0.65rem;
        gap: 3px;
        border-radius: 16px;
    }
    
    .btn-back span {
        display: none; /* Hide "Back to Jobs" text */
    }
    
    /* FIXED: ATS Score badge - same size as other buttons */
    .ats-score-badge {
        padding: 4px 8px; /* Same as other buttons */
        font-size: 0.65rem;
        gap: 3px;
        border-radius: 16px;
        white-space: nowrap;
        background: rgba(16, 185, 129, 0.9); /* Green background */
        color: white;
        display: flex;
        align-items: center;
    }
    
    .ats-score-badge::after {
        content: "100%"; /* Show percentage */
        font-weight: 700;
    }
    
    .ats-score-badge span {
        display: none; /* Hide original text */
    }
    
    .ats-score-badge i {
        font-size: 0.65rem;
    }
    
    /* Much smaller action buttons */
    .header-right .btn {
        padding: 4px 8px; /* Much smaller */
        font-size: 0.65rem;
        gap: 3px;
        border-radius: 16px;
    }
    
    .header-right .btn span {
        display: none; /* Hide button text on mobile */
    }
    
    .header-right .btn i {
        font-size: 0.65rem;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 0.75rem;
    }
    
    .tab-content {
        padding: 16px 20px 60px 20px;
    }
    
    .form-container {
        padding-bottom: 100px;
    }
    
    /* MOBILE INPUT SIZING - Smaller */
    .form-row {
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }
    
    .form-group {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        position: relative !important;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: calc(100vw - 60px) !important;
        min-width: 200px !important;
        min-height: 48px !important;
        height: auto !important;
        box-sizing: border-box !important;
        padding: 14px 16px !important;
        margin: 0 !important;
        font-size: 16px !important;
        line-height: 1.5 !important;
        -webkit-appearance: none !important;
        -webkit-border-radius: 12px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border: 2px solid rgba(255, 126, 95, 0.25) !important;
        color: var(--gray-900) !important;
        cursor: text !important;
        pointer-events: auto !important;
        user-select: text !important;
        -webkit-user-select: text !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="tel"]:focus,
    input[type="url"]:focus {
        border-color: var(--primary-color) !important;
        background: white !important;
        outline: none !important;
        box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.2) !important;
        transform: none !important;
    }
    
    /* Even smaller add buttons on mobile */
    .btn-add {
        padding: 6px 12px;
        font-size: 0.7rem;
        border-radius: 16px;
        gap: 4px;
        max-width: 120px;
        letter-spacing: 0;
    }
    
    .btn-add i {
        font-size: 0.7rem;
    }
    
    .additional-sections {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-container {
        padding: 18px;
    }
    
    .resume-preview {
        transform: none !important;
        width: 100%;
    }
    
    .floating-actions {
        bottom: calc(20px + env(safe-area-inset-bottom, 0));
        gap: 10px;
    }
    
    .btn-floating {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .scroll-progress {
        width: 45px;
        height: 45px;
        bottom: calc(15px + env(safe-area-inset-bottom, 0));
        right: calc(15px + env(safe-area-inset-right, 0));
        font-size: 0.8rem;
    }
    
    .ats-panel {
        width: 100%;
        right: -100%;
        top: 70px;
        height: calc(100vh - 70px);
    }
    
    .export-menu {
        right: 0; /* Align to right edge */
        left: auto;
        min-width: 180px;
        width: 200px; /* Fixed width for mobile too */
        max-width: calc(100vw - 24px);
    }
}

/* Small screens */
@media (max-width: 480px) {
    .header-content {
        padding: 0 14px;
    }
    
    .header-left {
        gap: 14px;
    }
    
    .header-left h1,
    .header-left .logo {
        font-size: 1.25rem;
    }
    
    .tab-btn {
        padding: 4px 8px;
        font-size: 0.65rem;
        gap: 3px;
    }
    
    .additional-sections {
        grid-template-columns: 1fr;
    }
    
    .zoom-controls {
        flex-direction: column;
        gap: 6px;
        padding: 8px 14px;
    }
    
    .zoom-controls span {
        font-size: 0.75rem;
    }
    
    .form-section {
        border-radius: var(--border-radius);
        margin-bottom: 16px;
    }
    
    .section-header {
        padding: 20px 24px;
    }
    
    .section-content {
        padding: 28px 24px;
    }
    
    .form-container {
        padding-bottom: 60px;
    }
    
    .tab-content {
        padding: 16px 20px !important;
    }
    
    /* Extra small mobile adjustments */
    .btn-add {
        padding: 5px 10px;
        font-size: 0.65rem;
        max-width: 100px;
    }
    
    /* Extra small mobile input adjustments */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"] {
        max-width: calc(100vw - 40px) !important;
        min-height: 50px !important;
        padding: 16px 18px !important;
        font-size: 16px !important;
        border-width: 3px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .section-content {
        padding: 16px 12px !important;
    }
    
    .export-menu {
        right: 0;
        left: auto;
        min-width: 180px;
        width: 200px;
        max-width: calc(100vw - 24px);
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }
    
    .template-card .template-info {
        padding: 12px;
    }
    
    .template-card .template-info h4 {
        font-size: 13px;
    }
    
    .template-card .template-info p {
        font-size: 11px;
    }
}

/* Extra large screens */
@media (min-width: 1600px) {
    .header-content {
        max-width: 1600px;
        margin: 0 auto;
    }
    
    .preview-container {
        padding: 40px;
    }
}

/* ===== ACCESSIBILITY & PERFORMANCE ===== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-primary,
    .btn-secondary {
        border-width: 2px;
    }
    
    .template-card {
        border-width: 3px;
    }
    
    .form-section {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn-ai::before {
        animation: none !important;
    }
}

/* Performance optimizations */
.resume-preview {
    will-change: transform;
    contain: layout style paint;
}

.form-section {
    contain: layout style;
}

.tab-content {
    contain: style;
}

/* Performance trims on mobile - softer shadows for 60fps */
@media (max-width: 768px) {
    .template-card,
    .form-section,
    .btn,
    .btn-add,
    .btn-ai {
        box-shadow: var(--shadow);
    }
}

/* Print optimizations */
@media print {
    .builder-header,
    .builder-panel,
    .preview-header,
    .notification,
    .floating-actions,
    .scroll-progress {
        display: none !important;
    }
    
    .preview-panel {
        width: 100%;
        height: auto;
        background: white;
    }
    
    .preview-container {
        padding: 0;
    }
    
    .resume-preview {
        transform: none !important;
        filter: none !important;
    }
}

/* CRITICAL: Ensure tab switching works */
.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Hide zoom controls when export dropdown is active */
.export-menu.active ~ .zoom-controls,
body.export-dropdown-open .zoom-controls {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}








/* === MOBILE HEADER: GRID + SAFE WRAP + BIGGER TABS (final override) === */
:root{
  --mobile-header-h: 122px;
  --mobile-tab-font: 1rem;
  --mobile-tab-pad-y: 12px;
  --mobile-tab-pad-x: 16px;
  --mobile-tab-gap: 12px;
  --mobile-toggle-size: 36px;
  --mobile-builder-vh: 45dvh;
  --mobile-preview-vh: 55dvh;
}

@media (max-width:768px){

  /* Header uses grid so items never clip off-screen */
  .builder-header{
    padding-top: env(safe-area-inset-top, 0);
    padding-right: env(safe-area-inset-right, 0);
    overflow: visible;
  }

  .header-content{
    display: grid !important;
    grid-template-columns: 1fr auto;          /* left area + right chips */
    grid-auto-rows: min-content;
    row-gap: 10px;
    column-gap: 10px;
    align-items: center;
    min-height: var(--mobile-header-h);
    height: auto;                              /* allow 2nd row */
    padding: 12px clamp(14px,4vw,20px);
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }

  .header-left{ grid-column: 1 / 2; }
  .header-left .logo{ font-size: 1.35rem; }

  /* Right cluster (ATS + Save) stays on the first row */
  .header-right{
    grid-column: 2 / 3;
    display: grid !important;
    grid-template-columns: auto auto;
    grid-auto-rows: min-content;
    justify-content: end;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .header-right > *{ min-width: 0; }

  /* Export dropdown takes the full second row, right aligned */
  .header-right .export-dropdown{
    grid-column: 1 / -1;
    justify-self: end;
    min-width: 0;
  }
  .header-right .export-dropdown #exportBtn{
    max-width: 100%;
    width: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;      /* never pushes off the screen */
  }
  .export-menu{
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    max-width: min(260px, 92vw);
    transform: none;              /* avoid accidental off-screen translate */
  }

  /* Chip sizing for ATS/Save/back — readable but compact */
  .btn-back,
  .header-right .btn,
  .ats-score-badge{
    padding: 8px 12px;
    font-size: .8rem;
    border-radius: 18px;
    gap: 6px;
  }

  /* Tabs: bigger, centered, with safe side margins */
  .panel-header{
    padding: 16px clamp(16px,5vw,24px);
    overflow: visible;
  }
  .panel-tabs{
    width: 100%;
    gap: var(--mobile-tab-gap);
    padding: 6px;
    border-radius: 18px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .panel-tabs .tab-btn{
    flex: 1 1 0;
    min-width: 0;
    padding: var(--mobile-tab-pad-y) var(--mobile-tab-pad-x);
    font-size: var(--mobile-tab-font);
    border-radius: 16px;
    gap: 8px;
  }
  .panel-tabs .tab-btn i{ font-size: 1em; }

  /* Preview toolbar: slim; hide zoom on mobile */
  .preview-header{ padding: 8px clamp(12px,3.5vw,16px); gap: 8px; }
  .preview-controls{ gap: 8px; }
  .btn-preview-toggle{
    width: var(--mobile-toggle-size);
    height: var(--mobile-toggle-size);
    border-width: 1px;
  }
  .zoom-controls{ display:none !important; }

  /* Panel height balance */
  .builder-container{ height: calc(100dvh - var(--mobile-header-h)) !important; }
  .builder-panel{
    height: var(--mobile-builder-vh) !important;
    border-bottom: 1px solid rgba(255,126,95,.15);
  }
  .tab-content{
    max-height: calc(var(--mobile-builder-vh) - 64px) !important;
    padding: 16px clamp(16px,4vw,22px) 64px;
  }
  .preview-panel{ height: var(--mobile-preview-vh) !important; }

  #previewContainer{
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto;
  }
}





/* Inherit H1 styling, bigger tap target */
h1.logo a.logo-link{
  color: inherit;
  text-decoration: none;
  display: inline-block;
  margin-left: 15px;        /* your spacing */
  position: relative;       /* for the underline */
  transition: transform .2s ease, filter .2s ease, color .2s ease;
}

/* Animated underline bar */
h1.logo a.logo-link::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,.6));
  border-radius: 2px;
  transition: width .25s ease;
}

/* Hover + keyboard focus: lift + underline + gradient text */
h1.logo a.logo-link:hover,
h1.logo a.logo-link:focus-visible{
  transform: translateY(-1px);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
  /* optional gradient text on hover */
  background-image: var(--gradient-elegant, linear-gradient(135deg,#ff7e5f,#6ec1e4));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1.logo a.logo-link:hover::after,
h1.logo a.logo-link:focus-visible::after{
  width: 100%;
}

/* Nice keyboard focus ring (kept from yours) */
h1.logo a.logo-link:focus-visible{
  outline: 3px solid rgba(255,255,255,.9);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Tactile press */
h1.logo a.logo-link:active{
  transform: translateY(0);
  filter: brightness(.98);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  h1.logo a.logo-link,
  h1.logo a.logo-link::after{
    transition: none;
  }
}




