/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-section,
.controls-section {
    margin-bottom: 2rem;
}

.template-section h3,
.controls-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.template-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.template-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
}

.template-preview {
    width: 100%;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    position: relative;
}

.template-preview::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    height: 8px;
    border-radius: 2px;
}

.modern-preview::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.classic-preview::before {
    background: linear-gradient(90deg, #4a5568, #2d3748);
}

.creative-preview::before {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}

.minimal-preview::before {
    background: linear-gradient(90deg, #e2e8f0, #cbd5e0);
}

.template-card span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    width: 100%;
    justify-content: center;
}

.btn-primary {
    background: #fbbf24;
    color: #1f2937;
}

.btn-primary:hover {
    background: #f59e0b;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-download {
    background: #10b981;
    color: white;
}

.btn-download:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    margin: 0.25rem;
}

.btn-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
}

.btn-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.cv-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* CV Display */
.cv-content {
    display: flex;
    min-height: 600px;
    font-size: 14px;
    line-height: 1.4;
}

.cv-sidebar {
    width: 35%;
    padding: 2rem 1.5rem;
    color: white;
    display: flex;
    flex-direction: column;
}

.cv-main {
    width: 65%;
    padding: 2rem;
    background: white;
    color: #1f2937;
}

/* Template Styles */
.template-modern .cv-sidebar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.template-classic .cv-sidebar {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.template-creative .cv-sidebar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.template-minimal .cv-sidebar {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #1f2937;
}

/* CV Profile */
.cv-profile {
    text-align: center;
    margin-bottom: 2rem;
}

.cv-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fbbf24;
}

.cv-title {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

/* Contact Info */
.cv-contact {
    margin-bottom: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.contact-item i {
    width: 20px;
    text-align: center;
    color: #fbbf24;
}

.personal-detail {
    margin-bottom: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.95);
}

.personal-detail i {
    width: 20px;
    text-align: center;
    color: #fbbf24;
    margin-right: 10px;
}

.personal-detail span {
    font-weight: 600;
    margin-right: 5px;
}

/* CV Sections */
.cv-section {
    margin-bottom: 2rem;
}

.cv-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skill-item,
.language-item {
    margin-bottom: 1rem;
}

.skill-name,
.language-name {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 500;
}

.skill-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: #fbbf24;
    border-radius: 3px;
}

/* Main Content Sections */
.cv-main-section {
    margin-bottom: 2rem;
}

.cv-main-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #667eea;
    text-transform: uppercase;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.cv-summary {
    font-size: 1rem;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 2rem;
}

/* Timeline */
.timeline {
    position: relative;
}

.timeline-item {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid #667eea;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    background: #667eea;
    border-radius: 50%;
}

.timeline-year {
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.timeline-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.timeline-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.timeline-description {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
}

/* Personal Details in Main Section */
.personal-details-grid {
    display: block;
    margin-bottom: 1rem;
}

.personal-detail-main {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 0.95rem;
    color: #374151;
    margin-bottom: 0.75rem;
    width: 100%;
}

.personal-detail-main i {
    width: 20px;
    text-align: center;
    color: #667eea;
    margin-right: 12px;
    font-size: 1rem;
}

.personal-detail-main span {
    font-weight: 600;
    margin-right: 8px;
}

/* Edit Panel */
.edit-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.edit-panel.active {
    right: 0;
}

.edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.edit-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
}

/* Form Styles */
.cv-form {
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #374151;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Photo Section */
.photo-section {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: #9ca3af;
    overflow: hidden;
    border: 3px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-preview:hover {
    border-color: #667eea;
    background: #f0f9ff;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.form-actions .btn {
    flex: 1;
    margin: 0;
}

/* Dynamic Form Items */
.form-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    position: relative;
}

.item-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.item-remove:hover {
    background: #dc2626;
}

/* Range Input */
input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.range-display {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    margin-top: 0.25rem;
}

/* Print Styles */
@media print {
    .sidebar,
    .edit-panel {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .cv-container {
        box-shadow: none;
        border-radius: 0;
        max-width: none;
        margin: 0;
    }
    
    .cv-content {
        min-height: auto;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .edit-panel {
        width: 450px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
        padding: 1rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
    
    .template-card {
        padding: 0.75rem;
    }
    
    .template-preview {
        height: 40px;
    }
    
    .template-card span {
        font-size: 0.8rem;
    }
    
    .main-content {
        order: 1;
        padding: 1rem;
    }
    
    .cv-container {
        border-radius: 8px;
    }
    
    .cv-content {
        flex-direction: column;
        min-height: auto;
        font-size: 13px;
    }
    
    .cv-sidebar,
    .cv-main {
        width: 100%;
    }
    
    .cv-sidebar {
        padding: 1.5rem;
    }
    
    .cv-main {
        padding: 1.5rem;
    }
    
    .edit-panel {
        width: 100%;
        right: -100%;
    }
    
    .edit-header {
        padding: 1rem;
    }
    
    .edit-header h2 {
        font-size: 1.1rem;
    }
    
    .cv-form {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-section {
        margin-bottom: 1.5rem;
    }
    
    .form-section h3 {
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 0.75rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.1rem;
        text-align: center;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .template-card {
        padding: 0.5rem;
        text-align: center;
    }
    
    .template-preview {
        height: 35px;
    }
    
    .template-card span {
        font-size: 0.75rem;
    }
    
    .controls-section h3,
    .template-section h3 {
        font-size: 0.9rem;
        text-align: center;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 0.375rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .cv-container {
        border-radius: 6px;
    }
    
    .cv-content {
        font-size: 12px;
    }
    
    .cv-sidebar,
    .cv-main {
        padding: 1rem;
    }
    
    .cv-photo {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }
    
    .cv-name {
        font-size: 1.3rem;
    }
    
    .cv-title {
        font-size: 0.9rem;
    }
    
    .contact-item {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .cv-section h3 {
        font-size: 1rem;
    }
    
    .cv-main-section h2 {
        font-size: 1.1rem;
    }
    
    .edit-header {
        padding: 0.75rem;
    }
    
    .edit-header h2 {
        font-size: 1rem;
    }
    
    .cv-form {
        padding: 0.75rem;
        height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .form-section {
        margin-bottom: 1.25rem;
    }
    
    .form-section h3 {
        font-size: 0.9rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.625rem;
        font-size: 0.85rem;
    }
    
    .photo-section {
        padding: 0.75rem;
    }
    
    .photo-preview {
        width: 80px;
        height: 80px;
        font-size: 1.5rem;
    }
    
    .btn-small {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .form-item {
        padding: 0.75rem;
    }
    
    .item-remove {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
    
    .form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 0.75rem;
        border-top: 1px solid #e5e7eb;
        margin: 1rem -0.75rem -0.75rem;
    }
    
    .range-display {
        font-size: 0.8rem;
    }
}
