/* ==========================================================================
   SSB RESUME BUILDER - iOS Glass Design System & Resume Layouts
   Ultra-Fast, Offline-Ready, PWA-Optimized Stylesheet (v37)
   ========================================================================== */

:root {
    --theme-color: #0a84ff;
    --theme-rgb: 10, 132, 255;
    --scale-factor: 1;
    --preview-zoom: 1;
    --bg-dark: #090a10;
    --glass-bg: rgba(20, 24, 36, 0.75);
    --glass-surface: rgba(255, 255, 255, 0.05);
    --glass-surface-hover: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-border-highlight: rgba(255, 255, 255, 0.22);
    --ios-blue: #0a84ff;
    --ios-green: #30d158;
    --ios-red: #ff453a;
    --ios-amber: #ffd60a;
    --ios-purple: #bf5af2;
    --ios-teal: #64d2ff;
    --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base Styles & Resets */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: #f1f5f9;
    font-family: var(--font-system);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image: 
        radial-gradient(circle at 12% 18%, rgba(10, 132, 255, 0.12), transparent 30%),
        radial-gradient(circle at 88% 25%, rgba(191, 90, 242, 0.10), transparent 32%),
        radial-gradient(circle at 50% 90%, rgba(48, 209, 88, 0.08), transparent 35%);
    background-attachment: fixed;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
}

/* Ambient Subtle Grid */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    z-index: -1;
    pointer-events: none;
}

/* EMBEDDED BRAND STYLING */
.brand-embedded {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.25);
    border-radius: 14px;
}

/* iOS Glass Panels & Cards */
.ios-glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-highlight);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.ios-glass-pill {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    border-radius: 9999px;
}

/* Custom Fast Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* iOS Form Inputs & Controls */
.ios-input, .ios-select, .ios-textarea {
    width: 100%;
    padding: 0.7rem 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.11);
    color: #ffffff;
    border-radius: 12px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
}

.ios-input::placeholder, .ios-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.ios-input:focus, .ios-select:focus, .ios-textarea:focus {
    border-color: var(--ios-blue);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.ios-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-opacity='0.7' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.9rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.2rem;
}

.ios-select option {
    background-color: #161b26;
    color: #ffffff;
}

/* iOS Range Slider (Colored Fill Track, Zero Overflow, Responsive Mobile Slider) */
.ios-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 7px;
    background: linear-gradient(to right, #0a84ff 0%, #0a84ff 100%, rgba(255, 255, 255, 0.18) 100%, rgba(255, 255, 255, 0.18) 100%);
    border-radius: 999px;
    outline: none;
    transition: background 0.05s ease;
    cursor: pointer;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.1);
    accent-color: #0a84ff;
}

.ios-range-slider::-webkit-slider-runnable-track {
    height: 7px;
    border-radius: 999px;
}

.ios-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0a84ff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    margin-top: -5.5px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ios-range-slider::-webkit-slider-thumb:hover,
.ios-range-slider::-webkit-slider-thumb:active {
    transform: scale(1.18);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.35), 0 3px 10px rgba(0, 0, 0, 0.6);
}

.ios-range-slider::-moz-range-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.ios-range-slider::-moz-range-progress {
    height: 7px;
    border-radius: 999px;
    background: #0a84ff;
}

.ios-range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0a84ff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* UNIFIED iOS GLASS BUTTONS & ICONS */
.ios-btn-glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ios-btn-glass:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

.ios-btn-glass:active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.18);
}

.ios-btn-primary {
    background: rgba(10, 132, 255, 0.22);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #ffffff;
    border: 1px solid rgba(10, 132, 255, 0.4);
    border-top: 1px solid rgba(10, 132, 255, 0.6);
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(10, 132, 255, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.ios-btn-primary:hover {
    background: rgba(10, 132, 255, 0.35);
    border-color: rgba(10, 132, 255, 0.6);
}

.ios-btn-primary:active {
    transform: scale(0.96);
}

/* iOS Segmented Control */
.ios-segmented {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 3px;
    display: inline-flex;
    position: relative;
}

.ios-segmented-btn {
    border-radius: 9px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ios-segmented-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Details / Accordion Styles */
details.ios-group {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

details.ios-group[open] {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

details.ios-group summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 0.85rem 1.05rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
}

details.ios-group summary::-webkit-details-marker {
    display: none;
}

/* ATS Strength Pill */
.ats-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(48, 209, 88, 0.12);
    border: 1px solid rgba(48, 209, 88, 0.28);
    color: #30d158;
    transition: transform 0.15s ease;
}

.ats-pill:hover {
    transform: scale(1.03);
}

/* Color Presets - Perfect Circular Apple Swatches */
.color-circle {
    width: 26px;
    height: 26px;
    border-radius: 50% !important;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.color-circle:hover, .color-circle.active {
    transform: scale(1.15);
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* HIGH-CONTRAST OPAQUE OBSIDIAN FLOATING PREVIEW TOOLBARS & CAPSULES */
.preview-toolbar-container {
    width: 100%;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ios-floating-pill, .preview-floating-bar {
    background: rgba(12, 16, 26, 0.96) !important;
    backdrop-filter: blur(28px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 0, 0, 0.4) !important;
    color: #ffffff !important;
}

.ios-floating-pill button, .preview-floating-bar button {
    cursor: pointer;
}

.preview-presets-bar {
    max-width: 96%;
}

.preview-zoom-bar {
    max-width: 96%;
}

/* HIGH-CONTRAST MOBILE NAVIGATION PANEL (CRISP, VIBRANT, NEVER WASHED OUT) */
.mobile-nav-panel {
    background: rgba(12, 16, 26, 0.96) !important;
    backdrop-filter: blur(28px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.4) !important;
    border-radius: 9999px !important;
    z-index: 50 !important;
}

.mobile-nav-panel .ios-segmented-btn {
    color: rgba(255, 255, 255, 0.75) !important;
    background: transparent !important;
    border: none !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    transition: all 0.2s ease !important;
    border-radius: 9999px !important;
}

.mobile-nav-panel .ios-segmented-btn:hover {
    color: #ffffff !important;
}

.mobile-nav-panel .ios-segmented-btn.active {
    background: #0a84ff !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(10, 132, 255, 0.5) !important;
    border-radius: 9999px !important;
}

/* ==========================================================================
   PREVIEW CANVAS & A4 ENGINE
   ========================================================================== */
#resume-preview-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 85px 16px 72px 16px; /* High clearance for mobile split pills on top & nav bar at bottom */
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.35);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    cursor: default;
}

@media (min-width: 640px) {
    #resume-preview-wrapper {
        padding: 56px 16px 56px 16px;
    }
}

#resume-preview-container {
    width: 794px;
    min-width: 794px;
    height: 1123px;
    min-height: 1123px;
    background: #ffffff;
    color: #1e293b;
    position: relative;
    transform-origin: center center;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
    margin: 0;
    overflow: hidden;
    border-radius: 14px; /* Modern iOS rounded preview card */
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    /* Prevent initial transition animation jump on page load */
    transition: none;
}

#resume-preview-container.animate-zoom {
    transition: transform 0.08s ease-out;
}

#resume-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

.resume-page {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    font-size: calc(13.5px * var(--scale-factor));
    line-height: 1.45;
}

.resume-page * {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Resume Fonts Selection */
.resume-font-sans { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif !important; }
.resume-font-display { font-family: 'Space Grotesk', -apple-system, sans-serif !important; }
.resume-font-serif { font-family: 'Merriweather', Georgia, serif !important; }
.resume-font-mono { font-family: 'Roboto Mono', Menlo, Consolas, monospace !important; }
.resume-font-editorial { font-family: 'Playfair Display', Georgia, serif !important; }

/* Resume Typography & Elements */
.res-name {
    font-size: calc(2.2rem * var(--scale-factor));
    font-weight: 700;
    line-height: 1.15;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.res-title {
    font-size: calc(1.05rem * var(--scale-factor));
    font-weight: 600;
    color: var(--theme-color);
    margin-bottom: 0.35rem;
}

.res-summary {
    font-size: calc(0.88rem * var(--scale-factor));
    color: #475569;
    line-height: 1.45;
    margin-top: calc(0.35rem * var(--scale-factor));
}

.res-section-title {
    text-transform: uppercase;
    font-weight: 700;
    font-size: calc(1.05rem * var(--scale-factor));
    color: var(--theme-color);
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: calc(0.25rem * var(--scale-factor));
    margin-top: calc(1rem * var(--scale-factor));
    margin-bottom: calc(0.55rem * var(--scale-factor));
    letter-spacing: 0.04em;
    line-height: 1;
}

.res-item {
    margin-bottom: calc(0.75rem * var(--scale-factor));
}

.res-item h3 {
    font-weight: 700;
    font-size: calc(0.95rem * var(--scale-factor));
    color: #0f172a;
    line-height: 1.25;
    margin: 0 0 2px 0;
}

.res-item .sub {
    font-size: calc(0.84rem * var(--scale-factor));
    color: #475569;
    display: flex;
    justify-content: space-between;
    font-style: italic;
    margin-bottom: 0.25rem;
}

.res-item ul {
    list-style: disc;
    margin-left: 1.2rem;
    margin-top: 0.2rem;
    font-size: calc(0.86rem * var(--scale-factor));
    line-height: 1.4;
    color: #334155;
}

/* Contact Info Item */
.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: calc(0.35rem * var(--scale-factor));
    font-size: calc(0.82rem * var(--scale-factor));
    line-height: 1.35;
    color: #334155;
}

.contact-icon {
    color: var(--theme-color);
    margin-right: 0.5rem;
    width: 15px;
    text-align: center;
    flex-shrink: 0;
}

.target-role-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: calc(0.72rem * var(--scale-factor));
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0.35rem;
}

.intl-details-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(0.4rem * var(--scale-factor));
    font-size: calc(0.82rem * var(--scale-factor));
    color: #64748b;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.03);
    padding: calc(0.45rem * var(--scale-factor));
    border-radius: 8px;
}

.intl-item span:first-child {
    font-weight: 600;
    color: #334155;
    margin-right: 4px;
}

/* ==========================================================================
   GLOBAL PROFILE PHOTO STYLING (ALWAYS CENTERED & ROUNDED / CIRCLE)
   ========================================================================== */
#preview-photo-container {
    overflow: hidden !important;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #cbd5e1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: border-radius 0.2s ease;
    position: relative;
    box-sizing: border-box;
    padding: 0 !important;
    margin: 0 auto;
}

#preview-photo {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: inherit !important;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#preview-photo.hidden {
    display: none !important;
}

#preview-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
}

#preview-photo-placeholder.hidden {
    display: none !important;
}

/* Indeterminate Progress Animation for PDF Loading Modal */
@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.animate-indeterminate {
    animation: indeterminate 1.4s infinite ease-in-out;
}

/* Explicit Photo Shape Modifiers - Perfect Circle & Rounded on Screen & Print */
.photo-shape-circle #preview-photo-container,
.photo-shape-circle #preview-photo,
.photo-shape-circle #preview-photo-placeholder {
    border-radius: 50% !important;
    -webkit-border-radius: 50% !important;
    clip-path: circle(50% at 50% 50%) !important;
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    overflow: hidden !important;
}

.photo-shape-rounded #preview-photo-container,
.photo-shape-rounded #preview-photo,
.photo-shape-rounded #preview-photo-placeholder {
    border-radius: 20px !important;
    -webkit-border-radius: 20px !important;
    clip-path: inset(0 round 20px) !important;
    -webkit-clip-path: inset(0 round 20px) !important;
    overflow: hidden !important;
}

#area-photo.photo-hidden {
    display: none !important;
}

.editor-thumb-box {
    width: 4rem;
    height: 4rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    text-align: center;
}

#editor-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2px;
    box-sizing: border-box;
}

#editor-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   10 RESUME LAYOUT SPECIFICATIONS (ALL WITH ROUNDED / CIRCLE PHOTOS)
   ========================================================================== */
.iso-sidebar, .iso-main, .iso-fulltop {
    box-sizing: border-box;
}

#resume-grid {
    width: 100%;
    height: 100%;
    display: grid;
}

/* 1. MODERN */
.layout-modern #resume-grid {
    grid-template-columns: 280px 1fr;
}
.layout-modern .iso-sidebar {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 2.2rem 1.4rem;
    height: 100%;
}
.layout-modern .iso-sidebar .contact-item {
    font-size: calc(0.76rem * var(--scale-factor));
}
.layout-modern .intl-details-box {
    grid-template-columns: 1fr;
}
.layout-modern .iso-main {
    padding: 2.8rem 2rem 1.5rem 2rem;
}
.layout-modern #area-photo {
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: center;
}
.layout-modern #preview-photo-container {
    width: 140px;
    height: 140px;
    border: 4px solid #cbd5e1;
}
.layout-modern #area-header {
    border-bottom: 2px solid var(--theme-color);
    padding-bottom: 1.2rem;
    margin-bottom: 1.2rem;
}

/* 2. CREATIVE */
.layout-creative #resume-grid {
    grid-template-columns: 260px 1fr;
}
.layout-creative .iso-sidebar {
    background: var(--theme-color);
    padding: 2.8rem 1.6rem;
    color: #ffffff;
    height: 100%;
}
.layout-creative .intl-details-box {
    grid-template-columns: 1fr;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}
.layout-creative .intl-item span:first-child {
    color: #ffffff;
}
.layout-creative .iso-main {
    padding: 2.8rem 2.2rem;
}
.layout-creative #area-photo {
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: center;
}
.layout-creative #preview-photo-container {
    width: 140px;
    height: 140px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    margin: 0 auto;
}
.layout-creative .iso-sidebar .res-item, 
.layout-creative .iso-sidebar h3, 
.layout-creative .iso-sidebar .contact-icon, 
.layout-creative .iso-sidebar .contact-item {
    color: #ffffff !important;
}
.layout-creative .iso-sidebar .res-section-title {
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

/* 3. TECH (Developer Monospace) */
.layout-tech #resume-grid {
    grid-template-columns: 1fr 240px;
    padding: 24px 30px;
    gap: 20px;
    font-family: 'Roboto Mono', Menlo, Consolas, monospace;
    grid-auto-flow: dense;
    align-content: start;
}
.layout-tech #area-header { grid-column: 1; }
.layout-tech #area-photo { grid-column: 2; display: flex; justify-content: flex-end; }
.layout-tech #preview-photo-container {
    width: 125px;
    height: 125px;
    border-radius: 20px;
    border: 3px solid var(--theme-color);
}
.layout-tech #area-contact {
    grid-column: 1 / span 2;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
    padding: 0.8rem 0;
    display: flex;
    gap: 1.4rem;
    flex-wrap: wrap;
}
.layout-tech #area-personal { grid-column: 1 / span 2; }
.layout-tech #area-exp, .layout-tech #area-proj { grid-column: 1; }
.layout-tech #area-skills, .layout-tech #area-edu, .layout-tech #area-cert, .layout-tech .area-custom { grid-column: 2; }
.layout-tech .res-name::before { content: ">_ "; color: var(--theme-color); }

/* 4. ROUNDED TIMELINE */
.layout-timeline #resume-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto auto 1fr;
    padding: 25px;
    height: 100%;
    gap: 18px;
    align-items: start;
}
.layout-timeline #area-header {
    grid-column: 1 / -1;
    grid-row: 1;
    margin-bottom: 0;
    background: #f8fafc;
    border-radius: 18px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid #e2e8f0;
}
.layout-timeline #area-contact {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 0;
    background: #0f172a;
    color: #ffffff;
    border-radius: 50px;
    padding: 8px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}
.layout-timeline #area-photo { margin: 0; flex-shrink: 0; }
.layout-timeline #preview-photo-container {
    width: 95px;
    height: 95px;
    border-radius: 20px;
    border: 3px solid var(--theme-color);
}
.layout-timeline .contact-item { margin-bottom: 0; color: #ffffff; }
.layout-timeline .contact-icon { color: var(--theme-color); }
.layout-timeline .timeline-sidebar {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.layout-timeline .timeline-main {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.layout-timeline .timeline-main .timeline-group {
    display: grid;
    grid-template-columns: 80px 15px 1fr;
    gap: 10px;
    margin-bottom: 0;
}
.layout-timeline .timeline-main .date-col {
    text-align: right;
    font-size: calc(0.78rem * var(--scale-factor));
    font-weight: 700;
    color: var(--theme-color);
    padding-top: 12px;
    line-height: 1.2;
}
.layout-timeline .timeline-main .line-col {
    position: relative;
    display: flex;
    justify-content: center;
}
.layout-timeline .timeline-main .line-col::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
    z-index: 1;
}
.layout-timeline .timeline-main .line-col::after {
    content: '';
    position: absolute;
    top: 16px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid var(--theme-color);
    border-radius: 50%;
    z-index: 2;
}
.layout-timeline .timeline-main .content-col {
    background: #f8fafc;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 10px;
    border: 1px solid #f1f5f9;
}

/* 5. EXECUTIVE */
.layout-executive #resume-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr;
    padding: 24px;
    gap: 22px;
}
.layout-executive .iso-fulltop {
    grid-column: 1 / span 2;
    background: var(--theme-color);
    padding: 2.2rem 2.5rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-radius: 18px;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
}
.layout-executive .iso-fulltop .res-name { color: #ffffff; }
.layout-executive .iso-fulltop .res-title { color: rgba(255, 255, 255, 0.9); }
.layout-executive .iso-fulltop .res-summary { color: rgba(255, 255, 255, 0.85); }
.layout-executive #area-photo { margin: 0; }
.layout-executive #preview-photo-container {
    border: 4px solid #ffffff;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.layout-executive .iso-sidebar {
    background: #f8fafc;
    padding: 1.8rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

/* 6. COMPACT (1-Page High Density) */
.layout-compact #resume-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 20px 25px;
    align-content: start;
    grid-auto-flow: dense;
}
.layout-compact #area-photo { grid-column: 3; display: flex; justify-content: flex-end; }
.layout-compact #preview-photo-container {
    width: 95px;
    height: 95px;
    border-radius: 18px;
    border: 2px solid var(--theme-color);
}
.layout-compact #area-header { grid-column: 1 / span 2; border-bottom: 3px solid var(--theme-color); }
.layout-compact #area-contact {
    grid-column: 1 / span 3;
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.layout-compact #area-exp, .layout-compact #area-proj { grid-column: 1 / span 2; }
.layout-compact #area-edu, .layout-compact #area-skills, .layout-compact #area-cert, .layout-compact .area-custom { grid-column: 3; }
.layout-compact .res-item { margin-bottom: 0.45rem; }

/* 7. MINIMALIST HARVARD (ATS Standard Single Column) */
.layout-minimalist #resume-grid {
    display: block;
    padding: 35px 45px;
    font-family: 'Merriweather', Georgia, serif;
    color: #111827;
}
.layout-minimalist #area-header {
    text-align: center;
    border-bottom: 2px solid #111827;
    padding-bottom: 1rem;
    margin-bottom: 1.2rem;
}
.layout-minimalist .res-name {
    font-size: calc(2.4rem * var(--scale-factor));
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.layout-minimalist #area-contact {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 0.5rem;
}
.layout-minimalist .contact-item {
    font-size: calc(0.85rem * var(--scale-factor));
}
.layout-minimalist .res-section-title {
    font-size: calc(1.05rem * var(--scale-factor));
    color: #111827;
    border-bottom: 1.5px solid #111827;
    letter-spacing: 0.08em;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}
.layout-minimalist #area-photo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}
.layout-minimalist #preview-photo-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid #334155;
}

/* 8. NORDIC ELEGANCE (Split Tone Top Card) */
.layout-nordic #resume-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: auto 1fr;
    padding: 24px;
    gap: 20px;
}
.layout-nordic .iso-fulltop {
    grid-column: 1 / -1;
    background: #f1f5f9;
    border-left: 6px solid var(--theme-color);
    padding: 1.8rem 2.2rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.layout-nordic #area-photo { margin: 0; }
.layout-nordic #preview-photo-container {
    width: 105px;
    height: 105px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.layout-nordic .iso-sidebar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.5rem;
}
.layout-nordic .iso-main {
    padding: 0.5rem;
}
.layout-nordic .res-section-title {
    border-bottom: 2px solid var(--theme-color);
    display: inline-block;
    padding-right: 2rem;
}

/* 9. CORPORATE LEFT-BAR */
.layout-corporate #resume-grid {
    display: grid;
    grid-template-columns: 270px 1fr;
    border-left: 10px solid var(--theme-color);
    height: 100%;
}
.layout-corporate #area-photo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.2rem;
}
.layout-corporate #preview-photo-container {
    width: 130px;
    height: 130px;
    border-radius: 20px;
    border: 3px solid var(--theme-color);
}
.layout-corporate .iso-sidebar {
    background: #f8fafc;
    padding: 2.5rem 1.6rem;
    border-right: 1px solid #e2e8f0;
}
.layout-corporate .iso-main {
    padding: 2.8rem 2.2rem;
}
.layout-corporate .res-section-title {
    background: #f1f5f9;
    padding: 4px 10px;
    border-left: 4px solid var(--theme-color);
    border-bottom: none;
    border-radius: 4px;
}

/* 10. MODERN GRID */
.layout-grid #resume-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    padding: 25px;
    gap: 20px;
}
.layout-grid #area-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px double var(--theme-color);
    padding-bottom: 1rem;
}
.layout-grid #area-photo {
    display: flex;
    justify-content: flex-end;
}
.layout-grid #preview-photo-container {
    width: 110px;
    height: 110px;
    border-radius: 20px;
    border: 3px solid var(--theme-color);
}
.layout-grid #area-contact {
    grid-column: 1 / -1;
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 0.6rem 1rem;
    border-radius: 10px;
}
.layout-grid .iso-col-1, .layout-grid .iso-col-2 {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.layout-grid .res-section-title {
    border-bottom: 2px solid #0f172a;
}

/* Custom Sections Dynamic Styling */
.area-custom {
    margin-top: calc(0.5rem * var(--scale-factor));
}

/* Skill Badges */
.skill-pill {
    background: #f1f5f9;
    color: #334155;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: calc(0.78rem * var(--scale-factor));
    font-weight: 600;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

/* Cropper Modal */
#cropper-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#cropper-wrapper {
    width: 90%;
    max-width: 500px;
    height: 50vh;
    background: #111;
    overflow: hidden;
    margin-bottom: 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#cropper-image {
    display: block;
    max-width: 100%;
}

/* Generic iOS Sheet / Modal */
.ios-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9990;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ios-modal-backdrop.open {
    display: flex;
    opacity: 1;
}

.ios-modal-dialog {
    background: #161a26;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.6rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ios-modal-backdrop.open .ios-modal-dialog {
    transform: translateY(0);
}

/* Toast Notifications */
#ios-toast-container {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ios-toast {
    background: rgba(20, 25, 38, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   AUTO RESPONSIVE LAYOUT ENGINE (DESKTOP, TABLET PORTRAIT, MOBILE)
   ========================================================================== */

/* 1. DESKTOP MODE (Auto on resolution >= 1024px, or landscape laptops/tablets >= 960px)
   Dual-Panel Side-by-Side: Preview on Left (col 1-7), Editor on Right (col 8-12) */
@media (min-width: 1024px), (min-width: 960px) and (orientation: landscape) {
    #main-workspace {
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        gap: 1rem !important;
        height: 100% !important;
        min-height: 0 !important;
    }
    #preview-panel {
        display: flex !important;
        grid-column: span 7 / span 7 !important;
        order: 1 !important; /* PREVIEW ON LEFT */
        height: 100% !important;
        min-height: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    #editor-panel {
        display: block !important;
        grid-column: span 5 / span 5 !important;
        order: 2 !important; /* EDITOR ON RIGHT */
        height: 100% !important;
        min-height: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .mobile-nav-panel {
        display: none !important;
    }
}

/* 2. TABLET PORTRAIT & MOBILE MODE (Auto on resolution < 1024px in portrait, or < 960px)
   High-Comfort Single-Panel Tabbed View: Active tab takes 100% width with bottom switcher */
@media (max-width: 1023px) and (orientation: portrait), (max-width: 959px) {
    #main-workspace {
        display: flex !important;
        flex-direction: column !important;
    }
    #preview-panel.hidden-mobile {
        display: none !important;
    }
    #editor-panel.hidden-mobile {
        display: none !important;
    }
    #preview-panel.visible-mobile {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
    }
    #editor-panel.visible-mobile {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
    }
    .mobile-nav-panel {
        display: flex !important;
    }
}

/* 3. TABLET PORTRAIT SPECIFIC AUTO-ADAPTATIONS (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    #resume-preview-wrapper {
        padding: 60px 24px 75px 24px;
    }
    .preview-toolbar-container {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }
}

/* 4. MOBILE SPECIFIC AUTO-ADAPTATIONS (< 768px) */
@media (max-width: 767px) {
    #resume-preview-wrapper {
        padding: 85px 12px 72px 12px;
    }
    .preview-toolbar-container {
        flex-direction: column !important;
        gap: 0.375rem !important;
    }
}

/* ==========================================================================
   DESKTOP & BROWSER PRINT STYLES (CRISP VECTOR A4, CIRCLE PHOTO, SQUARE EDGES)
   ========================================================================== */
@media print {
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    header, #editor-panel, .preview-floating-bar, .mobile-nav-panel, 
    #pdf-export-overlay, #ios-toast-container, .bg-grid, #ats-modal, 
    #profiles-modal, #cropper-modal, #ios-confirm-modal, #ios-prompt-modal,
    #welcome-template-modal, #app-startup-loader {
        display: none !important;
    }
    #preview-panel {
        display: block !important;
        position: static !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    #resume-preview-wrapper {
        display: block !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        transform: none !important;
    }
    #resume-preview-container {
        position: relative !important;
        transform: none !important;
        box-shadow: none !important;
        border-radius: 0 !important; /* Strictly square corners for real A4 paper */
        margin: 0 auto !important;
        width: 794px !important;
        min-width: 794px !important;
        height: 1123px !important;
        min-height: 1123px !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    .photo-shape-circle #preview-photo-container,
    .photo-shape-circle #preview-photo,
    .photo-shape-circle #preview-photo-placeholder {
        border-radius: 50% !important;
        -webkit-border-radius: 50% !important;
        clip-path: circle(50% at 50% 50%) !important;
        -webkit-clip-path: circle(50% at 50% 50%) !important;
        overflow: hidden !important;
    }
    .photo-shape-rounded #preview-photo-container,
    .photo-shape-rounded #preview-photo,
    .photo-shape-rounded #preview-photo-placeholder {
        border-radius: 20px !important;
        -webkit-border-radius: 20px !important;
        clip-path: inset(0 round 20px) !important;
        -webkit-clip-path: inset(0 round 20px) !important;
        overflow: hidden !important;
    }
    @page {
        size: A4 portrait;
        margin: 0;
    }
}
