
/* ===== Base Styles ===== */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --success-color: #4bb543;
    --danger-color: #ff3333;
    --warning-color: #ffcc00;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* ===== App Layout ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.app-header h1 span {
    color: var(--secondary-color);
}

.app-header p {
    color: var(--gray-color);
    font-size: 1.1rem;
}

.builder-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* ===== Footer Styles ===== */
.app-footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
    color: var(--gray-color);
    font-size: 0.9rem;
    border-top: 1px solid var(--light-gray);
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.app-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ===== Template Selection ===== */
.template-selection {
    margin-bottom: 2rem;
}

.template-selection h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.template-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.template-card.selected {
    border-color: var(--primary-color);
}

.template-preview {
    height: 350px;
    overflow: hidden;
    position: relative;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-info {
    padding: 1rem;
    text-align: center;
}

.template-info h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.template-info p {
    color: var(--gray-color);
    font-size: 0.9rem;
}

/* ===== Form Styles ===== */
.resume-form {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.resume-form h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
}

.form-section h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* ===== Experience/Education Entries ===== */
.experience-entry, .education-entry {
    background-color: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    position: relative;
}

.remove-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
}

/* ===== Skills Input ===== */
.skills-input-container {
    position: relative;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.skill-tag {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-tag .remove-skill {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-size: 1rem;
    gap: 0.5rem;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.primary-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.secondary-btn {
    background-color: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--light-color);
}

/* ===== Resume Preview ===== */
.resume-preview {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.preview-header h2 {
    color: var(--primary-color);
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.resume-paper {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20mm;
    position: relative;
    overflow: hidden;
}

/* ===== Template-specific Styles ===== */
/* These will be loaded dynamically based on the selected template */

/* ===== Responsive Design ===== */
/* Large desktop screens (1440px and up) */
@media (min-width: 1440px) {
    .builder-container {
        grid-template-columns: 1fr 1fr;
    }
    
    .resume-preview {
        grid-column: span 2;
    }
}

/* Standard desktop screens (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .builder-container {
        grid-template-columns: 1fr 1fr;
    }
    
    .resume-preview {
        grid-column: span 2;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Small desktop / large tablet (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .app-container {
        padding: 1.5rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .resume-paper {
        padding: 15mm;
    }
}

/* Tablet screens (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .app-container {
        padding: 1.25rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .resume-paper {
        padding: 10mm;
        transform: scale(0.95);
        transform-origin: top center;
    }
    
    .preview-header, .preview-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Large mobile screens (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .app-container {
        padding: 1rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .resume-form {
        padding: 1.5rem;
    }
    
    .resume-paper {
        transform: scale(0.9);
        width: 100%;
        padding: 8mm;
    }
    
    .template-preview {
        height: 300px;
    }
}

/* Small mobile screens (up to 575px) */
@media (max-width: 575px) {
    .app-container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .resume-form {
        padding: 1rem;
    }
    
    .form-section {
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .experience-entry, .education-entry {
        padding: 1rem;
    }
    
    .resume-paper {
        transform: scale(0.85);
        width: 100%;
        padding: 5mm;
        min-height: auto;
    }
    
    .template-preview {
        height: 250px;
    }
    
    .preview-actions .btn {
        width: 100%;
    }
}

/* Print styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .resume-paper, .resume-paper * {
        visibility: visible;
    }
    
    .resume-paper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    
    .preview-actions {
        display: none !important;
    }
    
    .app-footer {
        display: none !important;
    }
}

/* Very small screens (under 400px) */
@media (max-width: 400px) {
    .app-header h1 {
        font-size: 1.75rem;
    }
    
    .app-header p {
        font-size: 1rem;
    }
    
    .contact-info span {
        font-size: 0.9rem;
    }
    
    .resume-paper {
        transform: scale(0.8);
    }
    
    .app-footer {
        font-size: 0.8rem;
        padding: 1rem 0;
    }
}

/* Orientation-specific styles */
@media (orientation: portrait) {
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (orientation: landscape) and (max-width: 991px) {
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* High-density displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { 
    .template-card {
        border-width: 1px;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #f5f5f5;
    }
    
    .resume-form,
    .template-card,
    .resume-preview,
    .experience-entry,
    .education-entry,
    .app-footer {
        background-color: #1e1e1e;
        color: #f5f5f5;
    }
    
    input, textarea, select {
        background-color: #2d2d2d;
        color: #f5f5f5;
        border-color: #444;
    }
    
    .template-info p,
    .job-title,
    .company,
    .date,
    .school {
        color: #bbb !important;
    }
    
    .app-footer a {
        color: var(--accent-color);
    }
}