* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Editor Panel */
.editor-panel {
    width: 40%;
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.editor-header {
    padding: 20px 30px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.editor-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-add {
    background: #27ae60;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-add:hover {
    background: #229954;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 5px 15px;
    font-size: 12px;
}

.btn-remove:hover {
    background: #c0392b;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.editor-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.editor-section h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.dynamic-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

.dynamic-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dynamic-item-header h3 {
    font-size: 14px;
    color: #2c3e50;
}

/* Preview Panel */
.preview-panel {
    width: 60%;
    background: #e8e8e8;
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-controls button {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.zoom-controls button:hover {
    background: #f0f0f0;
    border-color: #3498db;
}

.zoom-controls span {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

.preview-container {
    flex: 1;
    overflow: auto;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Resume Preview - Letter Size (8.5" x 11") */
.resume-preview {
    width: 8.5in;
    min-height: 11in;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 0.3in;
    transform-origin: top center;
    transition: transform 0.3s ease;
}

/* Resume Content Styles */
.resume-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2c3e50;
}

.resume-name {
    font-size: 36px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.resume-title {
    font-size: 20px;
    color: #3498db;
    font-weight: 500;
    margin-bottom: 12px;
}

.resume-contact {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #555;
}

.resume-contact-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.resume-section {
    margin-bottom: 14px;
}

.resume-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #3498db;
}

.resume-summary {
    font-size: 13px;
    line-height: 1.6;
    color: #444;
    text-align: justify;
}

.resume-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-tag {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.resume-item {
    margin-bottom: 12px;
    page-break-inside: avoid;
}

.resume-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.resume-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
}

.resume-item-subtitle {
    font-size: 13px;
    color: #3498db;
    font-weight: 600;
}

.resume-item-date {
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

.resume-item-location {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.resume-item-description {
    font-size: 12px;
    line-height: 1.6;
    color: #555;
    margin-top: 5px;
}

.resume-item-description ul {
    margin: 4px 0;
    padding-left: 18px;
}

.resume-item-description li {
    margin-bottom: 3px;
}

.resume-item-technologies {
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 5px;
    font-style: italic;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .editor-panel,
    .preview-header,
    .action-buttons {
        display: none !important;
    }
    
    .app-container {
        display: block;
    }
    
    .preview-panel {
        width: 100%;
        background: white;
    }
    
    .preview-container {
        padding: 0;
    }
    
    .resume-preview {
        width: 100%;
        box-shadow: none;
        margin: 0;
        padding: 0.3in;
    }
    
    /* Prevent page breaks inside important elements */
    .resume-header,
    .resume-section,
    .resume-item {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Control page breaks between sections */
    .resume-section {
        page-break-after: auto;
        break-after: auto;
    }
    
    /* Ensure section titles stay with content */
    .resume-section-title {
        page-break-after: avoid;
        break-after: avoid;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Keep experience items together */
    .resume-item {
        page-break-inside: avoid;
        break-inside: avoid;
        orphans: 3;
        widows: 3;
    }
    
    /* Sidebar template specific print styles */
    .template-sidebar .resume-sidebar,
    .template-sidebar .resume-main {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Template Selector */
.template-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.template-option {
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
}

.template-option:hover {
    transform: translateY(-5px);
}

.template-option span {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.template-preview-box {
    width: 100%;
    height: 120px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-option:hover .template-preview-box {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.template-preview-box::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 20px;
    border-radius: 3px;
}

.template-preview-box::after {
    content: '';
    position: absolute;
    top: 35px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 3px;
}

.template-modern-preview::before {
    background: linear-gradient(90deg, #2c3e50 0%, #2c3e50 100%);
}

.template-modern-preview::after {
    background: repeating-linear-gradient(
        0deg,
        #3498db 0px,
        #3498db 2px,
        transparent 2px,
        transparent 12px
    );
}

.template-classic-preview::before {
    background: #333;
    border-bottom: 3px double #333;
}

.template-classic-preview::after {
    background: repeating-linear-gradient(
        0deg,
        #666 0px,
        #666 1px,
        transparent 1px,
        transparent 12px
    );
}

.template-minimal-preview::before {
    background: #ddd;
}

.template-minimal-preview::after {
    background: repeating-linear-gradient(
        0deg,
        #ddd 0px,
        #ddd 1px,
        transparent 1px,
        transparent 12px
    );
}

.template-professional-preview::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-professional-preview::after {
    background: repeating-linear-gradient(
        0deg,
        #667eea 0px,
        #667eea 2px,
        transparent 2px,
        transparent 12px
    );
}

.template-sidebar-preview {
    display: flex;
}

.template-sidebar-preview::before {
    width: 25%;
    background: #2c3e50;
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    height: auto;
}

.template-sidebar-preview::after {
    width: 75%;
    left: 25%;
    right: 0;
    background: repeating-linear-gradient(
        0deg,
        #3498db 0px,
        #3498db 2px,
        transparent 2px,
        transparent 12px
    );
}

.template-option.active .template-preview-box {
    border-color: #27ae60;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.template-option.active span {
    color: #27ae60;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        flex-direction: column;
    }
    
    .editor-panel,
    .preview-panel {
        width: 100%;
    }
    
    .editor-panel {
        height: 50vh;
    }
    
    .preview-panel {
        height: 50vh;
    }
    
    .template-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .template-sidebar .resume-preview {
        flex-direction: column;
    }
    
    .template-sidebar .resume-sidebar,
    .template-sidebar .resume-main {
        width: 100%;
    }
}
