/* =========================
   Resume Builder - Modern Styles
========================= */

:root {
    --crb-primary: #2563eb;
    --crb-primary-dark: #1e40af;
    --crb-secondary: #64748b;
    --crb-success: #10b981;
    --crb-danger: #ef4444;
    --crb-warning: #f59e0b;
    --crb-bg: #f8fafc;
    --crb-bg-light: #ffffff;
    --crb-border: #e2e8f0;
    --crb-text: #1e293b;
    --crb-text-light: #64748b;
    --crb-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --crb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --crb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --crb-radius: 8px;
    --crb-radius-lg: 12px;
    --crb-transition: all 0.3s ease;
}

/* Reset & Base */
.crb-resume-builder * {
    box-sizing: border-box;
}

.crb-resume-builder {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--crb-text);
    line-height: 1.6;
}

/* Header */
.crb-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.crb-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--crb-text);
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, var(--crb-primary) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crb-subtitle {
    font-size: 1.125rem;
    color: var(--crb-text-light);
    margin: 0;
}

/* Progress Bar */
.crb-progress {
    width: 100%;
    height: 4px;
    background: var(--crb-border);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.crb-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--crb-primary) 0%, #7c3aed 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Sections */
.crb-section {
    background: var(--crb-bg-light);
    border-radius: var(--crb-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--crb-shadow);
    transition: var(--crb-transition);
}

.crb-section:hover {
    box-shadow: var(--crb-shadow-md);
}

.crb-section-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--crb-border);
}

.crb-section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--crb-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.crb-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--crb-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
}

.crb-section-desc {
    color: var(--crb-text-light);
    font-size: 0.875rem;
    margin: 0.5rem 0 0 0;
}

.crb-btn-add-section {
    margin-top: 1rem;
    background: var(--crb-success);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--crb-radius);
    cursor: pointer;
    transition: var(--crb-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.crb-btn-add-section:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--crb-shadow-md);
}

/* Form Grid */
.crb-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.crb-form-group {
    display: flex;
    flex-direction: column;
}

.crb-form-group-full {
    grid-column: 1 / -1;
}

.crb-label {
    font-weight: 500;
    color: var(--crb-text);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.crb-required {
    color: var(--crb-danger);
}

/* Inputs */
.crb-input,
.crb-select,
.crb-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--crb-border);
    border-radius: var(--crb-radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--crb-text);
    background: var(--crb-bg-light);
    transition: var(--crb-transition);
}

.crb-input:focus,
.crb-select:focus,
.crb-textarea:focus {
    outline: none;
    border-color: var(--crb-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.crb-textarea {
    resize: vertical;
    min-height: 100px;
}

/* File Upload */
.crb-file-upload {
    position: relative;
}

.crb-file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.crb-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--crb-border);
    border-radius: var(--crb-radius);
    background: var(--crb-bg);
    cursor: pointer;
    transition: var(--crb-transition);
    text-align: center;
}

.crb-file-label:hover {
    border-color: var(--crb-primary);
    background: rgba(37, 99, 235, 0.05);
}

.crb-file-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.crb-file-text {
    font-weight: 500;
    color: var(--crb-text);
    margin-bottom: 0.25rem;
}

.crb-file-hint {
    font-size: 0.875rem;
    color: var(--crb-text-light);
}

.crb-file-preview {
    margin-top: 1rem;
    display: none;
}

.crb-file-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--crb-radius);
    box-shadow: var(--crb-shadow);
}

.crb-file-preview.active {
    display: block;
}

/* Sortable Sections */
.crb-sortable-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crb-sortable-item {
    background: var(--crb-bg);
    border: 2px solid var(--crb-border);
    border-radius: var(--crb-radius);
    padding: 1rem;
    transition: var(--crb-transition);
    cursor: move;
}

.crb-sortable-item:hover {
    border-color: var(--crb-primary);
    box-shadow: var(--crb-shadow-md);
}

.crb-sortable-item.ui-sortable-helper {
    box-shadow: var(--crb-shadow-lg);
    transform: rotate(2deg);
}

.crb-sortable-handle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--crb-border);
}

.crb-drag-icon {
    color: var(--crb-text-light);
    font-size: 1.25rem;
    cursor: grab;
    flex-shrink: 0;
}

.crb-drag-icon:active {
    cursor: grabbing;
}

.crb-section-title-input {
    flex: 1;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--crb-text);
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--crb-radius);
    transition: var(--crb-transition);
    font-family: inherit;
}

.crb-section-title-input:focus {
    outline: none;
    background: var(--crb-bg);
    box-shadow: 0 0 0 2px var(--crb-primary);
}

.crb-section-title-input:hover {
    background: var(--crb-bg);
}

.crb-section-remove {
    background: none;
    border: none;
    color: var(--crb-danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--crb-radius);
    transition: var(--crb-transition);
    opacity: 0.7;
    flex-shrink: 0;
}

.crb-section-remove:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

.crb-sortable-item .crb-textarea {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.crb-sortable-item .crb-textarea:focus {
    box-shadow: none;
    border: none;
}

/* Buttons */
.crb-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--crb-border);
}

.crb-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--crb-radius);
    cursor: pointer;
    transition: var(--crb-transition);
    text-decoration: none;
    font-family: inherit;
}

.crb-btn-primary {
    background: linear-gradient(135deg, var(--crb-primary) 0%, #7c3aed 100%);
    color: white;
    box-shadow: var(--crb-shadow-md);
}

.crb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--crb-shadow-lg);
}

.crb-btn-secondary {
    background: var(--crb-bg-light);
    color: var(--crb-text);
    border: 2px solid var(--crb-border);
}

.crb-btn-secondary:hover {
    background: var(--crb-bg);
    border-color: var(--crb-primary);
}

.crb-btn-icon {
    font-size: 1.125rem;
}

/* Preview Styles */
.crb-resume-preview {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.crb-resume {
    background: var(--crb-bg-light);
    border-radius: var(--crb-radius-lg);
    padding: 3rem;
    box-shadow: var(--crb-shadow-lg);
    margin-bottom: 2rem;
}

.crb-resume h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: var(--crb-text);
}

.crb-resume .crb-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--crb-border);
    margin-bottom: 1.5rem;
}

.crb-resume h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--crb-border);
    color: var(--crb-text);
}

.crb-resume p {
    margin: 0.5rem 0;
    color: var(--crb-text);
    line-height: 1.8;
}

.crb-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: var(--crb-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--crb-radius);
    font-weight: 600;
    transition: var(--crb-transition);
    margin-top: 2rem;
}

.crb-download:hover {
    background: var(--crb-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--crb-shadow-md);
}

/* Template Specific Styles */
.template-ats h3 {
    border-bottom: 2px solid #000;
    color: #000;
}

.template-modern h3 {
    border-bottom: 2px solid var(--crb-primary);
    color: var(--crb-primary);
}

.template-designer {
    background: #1e293b;
    color: #f1f5f9;
}

.template-designer h3 {
    border-bottom: 2px solid #fbbf24;
    color: #fbbf24;
}

.template-creative h3 {
    border-bottom: 2px solid #ec4899;
    color: #ec4899;
}

.template-minimal h3 {
    border-bottom: 1px solid var(--crb-border);
    color: var(--crb-text);
    font-weight: 400;
}

.template-classic h3 {
    border-bottom: 3px solid #92400e;
    color: #92400e;
}

.template-professional h3 {
    border-bottom: 2px solid #059669;
    color: #059669;
}

/* Responsive Design */
@media (max-width: 768px) {
    .crb-resume-builder {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .crb-title {
        font-size: 2rem;
    }

    .crb-section {
        padding: 1.5rem;
    }

    .crb-form-grid {
        grid-template-columns: 1fr;
    }

    .crb-form-actions {
        flex-direction: column;
    }

    .crb-btn {
        width: 100%;
        justify-content: center;
    }

    .crb-resume {
        padding: 2rem 1.5rem;
    }
}

/* Loading State */
.crb-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crb-section {
    animation: fadeIn 0.3s ease-out;
}

/* Preview Modal */
.crb-preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.crb-preview-modal-content {
    background: var(--crb-bg-light);
    border-radius: var(--crb-radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--crb-shadow-lg);
    animation: slideUp 0.3s ease-out;
}

.crb-preview-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--crb-border);
}

.crb-preview-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--crb-text);
}

.crb-preview-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--crb-text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--crb-transition);
}

.crb-preview-close:hover {
    background: var(--crb-bg);
    color: var(--crb-text);
}

.crb-preview-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.crb-preview-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--crb-border);
    display: flex;
    justify-content: flex-end;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .crb-resume-builder {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .crb-header,
    .crb-form-actions,
    .crb-download {
        display: none;
    }

    .crb-resume {
        box-shadow: none;
        padding: 0;
    }
}
