/* === RESUME BUILDER: COMPLETE & SELF-CONTAINED STYLESHEET (Final) === */

/* --- 1. Root Variables & Global Styles --- */
:root {
    --dark-bg: #0A0A10; --surface-bg: #111119; --border-color: rgba(255, 255, 255, 0.1);
    --primary: #00d4ff; --primary-glow: rgba(0, 212, 255, 0.5); --accent: #ff477b;
    --text-primary: #ECEFF1; --text-secondary: #90A4AE; --font-family: 'Poppins', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--dark-bg); color: var(--text-primary); font-family: var(--font-family); line-height: 1.7; }
a { color: var(--primary); text-decoration: none; } a:hover { color: white; }

/* --- 2. Navigation (Self-contained) --- */
nav {
    padding: 1rem 5%;
    background: rgba(10, 10, 16, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}
nav:last-of-type {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
}
.logo { font-size: 1.8rem; font-weight: 800; }
.logo span { color: var(--primary); text-shadow: 0 0 10px var(--primary-glow); }
nav ul {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
nav a {
    color: var(--text-secondary); padding: 0.5rem 1rem; border-radius: 8px; font-weight: 500;
    display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; transition: all 0.3s ease;
}
nav a:hover { color: var(--text-primary); background-color: var(--surface-bg); }
nav a.active { color: var(--primary); background: var(--surface-bg); }

/* --- 3. Buttons & Surface Glow (Global) --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.8rem 1.8rem; border-radius: 50px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: all 0.3s ease; }
.btn-primary { background: var(--primary); color: #000; box-shadow: 0 0 25px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 0 40px var(--primary-glow); }
.surface-glow { background: var(--surface-bg); border-radius: 16px; position: relative; }
.surface-glow::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: inherit; padding: 1px;
    background: conic-gradient(from var(--angle), transparent 20%, var(--primary), var(--accent), transparent 80%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: spin 5s linear infinite paused; opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.surface-glow:hover::before { animation-play-state: running; opacity: 1; }
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --angle: 360deg; } }

/* === RESUME-SPECIFIC STYLES START HERE === */

/* --- 4. Page Layout & Header --- */
.resume-builder-container { max-width: 1000px; margin: 0 auto; padding: 3rem 1rem; }
.page-header { text-align: center; margin-bottom: 2rem; }
.page-header h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.page-header .subtitle { color: var(--text-secondary); font-size: 1.1rem; }
#resumeForm { padding: 2.5rem; }

/* --- 5. Form Sections & Grid Layout --- */
.form-section {
    margin-bottom: 2.5rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--border-color);
    opacity: 0; transform: translateY(20px); animation: fade-in-up 0.6s ease-out forwards;
}
/* Staggered animation for each section */
.form-section:nth-child(n+1) { animation-delay: calc(0.1s * (1)); }
.form-section:nth-child(n+2) { animation-delay: calc(0.1s * (2)); }
.form-section:nth-child(n+3) { animation-delay: calc(0.1s * (3)); }
.form-section:nth-child(n+4) { animation-delay: calc(0.1s * (4)); }
.form-section:nth-child(n+5) { animation-delay: calc(0.1s * (5)); }
@keyframes fade-in-up { to { opacity: 1; transform: translateY(0); } }

#resumeForm .form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.section-title i { font-size: 1.5rem; color: var(--primary); }
.section-title h2 { font-size: 1.5rem; margin: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label { display: block; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.5rem; }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.9rem 1rem; background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color); color: var(--text-primary);
    border-radius: 8px; font-size: 1rem; font-family: var(--font-family);
    transition: all 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group textarea { resize: vertical; min-height: 120px; }

/* --- 6. Template Selection (CORRECTED & ENHANCED) --- */
.template-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }

.template-option {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    /* Add a border for selection feedback */
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.template-option img {
    width: 100%;
    display: block;
    transition: transform 0.3s ease;
}

.template-option span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    background: rgba(17, 17, 25, 0.8); /* Slightly different from surface-bg */
    backdrop-filter: blur(5px);
    transition: background-color 0.3s, color 0.3s;
}

/* Hide the actual radio button */
.template-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Hover effect */
.template-option:hover {
    transform: translateY(-5px);
    border-color: var(--text-secondary);
}
.template-option:hover img {
    transform: scale(1.05);
}

/* --- CHECKED/SELECTED STATE --- */
.template-option input[type="radio"]:checked + img + span {
    background-color: var(--primary);
    color: var(--dark-bg);
}
.template-option input[type="radio"]:checked ~ img {
    /* No change needed, border does the work */
}
.template-option input[type="radio"]:checked {
    /* The border on the parent label provides the main feedback */
}
.template-option input[type="radio"]:checked + img {
    /* The border is on the parent label now */
}

/* Add a visual checkmark icon to the selected option */
.template-option::after {
    content: '\f00c'; /* Font Awesome checkmark */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.2rem;
    color: white;
    background-color: var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy effect */
}

.template-option input[type="radio"]:checked ~ ::after {
    transform: scale(1);
    opacity: 1;
}

/* Focus state for accessibility */
.template-option input[type="radio"]:focus-visible + img {
    outline: 3px solid var(--primary);
    outline-offset: -3px; /* Inside the border */
    border-radius: 12px;
}


/* --- 7. Form Submission & Spinner --- */
.form-submission { text-align: center; margin-top: 2.5rem; }
.form-submission .btn-primary { padding: 1rem 3rem; font-size: 1.1rem; }

.fa-spinner { animation: spin-button 1.5s linear infinite; }
@keyframes spin-button { to { transform: rotate(360deg); } }

/* Responsive */
@media(max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    #resumeForm { padding: 1.5rem; }
}