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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
}

/* Default card container for standalone landing pages (e.g. index.php) */
.home-card-container,
body:not(.gallery-body):not(.builder-body) > .container:not(.gallery-hero *):not(header *):not(main *):not(nav *):not(.container-fluid) {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 50px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
}

/* Explicitly ensure hero, header, and gallery containers are transparent and responsive */
.gallery-hero .container,
header .container,
nav .container,
main.container,
.gallery-hero-container {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

header {
    text-align: center;
    margin-bottom: 45px;
    padding-bottom: 25px;
    border-bottom: 4px solid #667eea;
}

header h1 {
    color: #2c3e50;
    font-size: 2.8em;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header p {
    color: #7f8c8d;
    font-size: 1.15em;
    font-weight: 400;
}

.back-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    margin-top: 10px;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.main-content {
    text-align: center;
}

.intro-section h2 {
    color: #333;
    margin-bottom: 30px;
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
}

.btn {
    display: inline-block;
    padding: 16px 35px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1em;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #653a8a 0%, #5568d3 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.4);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9em;
}

.features {
    text-align: left;
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
}

.features h3 {
    color: #333;
    margin-bottom: 15px;
}

.features ul {
    list-style: none;
}

.features li {
    padding: 10px 0;
    color: #555;
    position: relative;
    padding-left: 25px;
}

.features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Form Styles */
.resume-form {
    text-align: left;
}

.form-section {
    margin-bottom: 45px;
    padding: 35px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.form-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.6em;
    font-weight: 700;
    border-bottom: 3px solid #667eea;
    padding-bottom: 12px;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.form-group input[type="file"] {
    padding: 10px;
    border: 2px dashed #667eea;
    background: #f8f9ff;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: #7f8c8d;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.experience-item,
.education-item {
    padding: 25px;
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.template-option {
    padding: 18px;
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.template-option:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

.template-option input[type="radio"] {
    display: none;
}

.template-option input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 700;
}

.template-option input[type="radio"]:checked ~ * {
    border-color: #667eea;
}

.template-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
    transform: translateY(-3px);
}

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

@media (max-width: 768px) {
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

/* Preview Styles */
.preview-container {
    max-width: 1040px;
    margin: 24px auto 40px auto;
    padding: 0 15px;
}

.preview-actions {
    background: #ffffff;
    padding: 14px 20px;
    border-radius: 14px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.preview-nav-group,
.preview-tools-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Dedicated Preview Action Buttons */
.preview-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: inherit;
    line-height: 1;
}

.preview-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-btn:active {
    transform: translateY(0);
}

/* Button Variants */
.preview-btn-nav {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.preview-btn-nav:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.preview-btn-edit {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}
.preview-btn-edit:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
}

.preview-btn-word {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
}
.preview-btn-word:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #ffffff;
}

.preview-btn-pdf {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
}
.preview-btn-pdf:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    color: #ffffff;
}

.preview-btn-preview {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}
.preview-btn-preview:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
}

.preview-btn-print {
    background: #475569;
    color: #ffffff;
}
.preview-btn-print:hover {
    background: #334155;
    color: #ffffff;
}

/* Template Badge */
.preview-template-badge {
    background: #f8fafc;
    color: #0f172a;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.preview-template-badge i {
    color: #4f46e5;
}

@media (max-width: 900px) {
    .preview-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .preview-nav-group,
    .preview-tools-group {
        justify-content: center;
    }
}

.resume-preview {
    background: white;
    padding: 0;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    min-height: 800px;
    overflow: hidden;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    @page {
        margin: 0 !important;
        padding: 0 !important;
        size: A4 portrait;
    }
    
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: white !important;
    }
    
    .template-name-display,
    .template-switcher,
    button,
    .btn {
        display: none !important;
    }
    
    .preview-container {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        background: white !important;
    }
    
    .preview-actions {
        display: none !important;
    }
    
    .resume-preview {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: white !important;
    }
    
    .resume-template {
        margin: 0 auto !important;
        max-width: 210mm !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .template-selection {
        flex-direction: column;
    }
}

/* Globally disable any legacy template switcher blocks on all screens */
.template-switcher,
.quick-template-switcher,
.test-template-switcher,
[class*="template-switcher"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
}

