/* frontend.css - Improved editor, preview, responsiveness, and print helpers */
.rg-resume-builder {
    --rg-accent: #234a8a;
    max-width: 1400px;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f5f7fa;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.rg-resume-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.rg-resume-title {
    margin: 0;
    font-weight: 600;
    color: #1e293b;
    font-size: 26px;
}

.rg-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rg-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 9px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    white-space: nowrap;
}

.rg-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.rg-btn-print { background: #eef2ff; border-color: #a5b4fc; }
.rg-btn-pdf { background: #fef2f2; border-color: #fca5a5; }
.rg-btn-reset { background: #fefce8; border-color: #fde047; }

.rg-template-selector {
    padding: 8px 32px 8px 12px;
    border-radius: 30px;
    border: 1px solid #cbd5e1;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23334155" d="M6 9L1 4h10z"/></svg>') no-repeat right 12px center;
    background-size: 12px;
    cursor: pointer;
    font-size: 14px;
    min-width: 130px;
    appearance: none;
    -webkit-appearance: none;
}

.rg-accent-picker {
    padding: 4px;
    border-radius: 30px;
    border: 1px solid #cbd5e1;
    background: white;
    cursor: pointer;
    width: 50px;
    height: 38px;
}

.rg-resume-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.rg-editor-panel {
    flex: 1 1 35%;
    min-width: 320px;
    max-width: 430px;
    background: white;
    border-radius: 16px;
    padding: 12px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.rg-editor-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 12px;
}

.rg-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.rg-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.rg-section-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.rg-section-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rg-add-item {
    background: var(--rg-accent, #234a8a);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.rg-toggle-section {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #0f172a;
}

.rg-toggle-section:hover {
    background: #e2e8f0;
}

.rg-section-content {
    padding: 12px;
}

.rg-field {
    margin-bottom: 10px;
}

.rg-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.rg-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.rg-field input,
.rg-field textarea,
.rg-field select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    background: #fff;
}

.rg-field input:focus,
.rg-field textarea:focus,
.rg-field select:focus {
    outline: none;
    border-color: var(--rg-accent);
    box-shadow: 0 0 0 3px rgba(35, 74, 138, 0.12);
}

.rg-field textarea {
    resize: vertical;
}

.rg-photo-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rg-photo-preview img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
}

.rg-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    position: relative;
}

.rg-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    cursor: pointer;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rg-item-remove:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.rg-preview-panel {
    flex: 1 1 60%;
    min-width: 500px;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
}

.rg-preview-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.rg-print-hint {
    color: #475569;
    font-size: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 999px;
}

.rg-content-overflow .rg-print-hint {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.rg-resume-preview {
    width: 100%;
    max-width: 794px;
    min-height: 1123px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    padding: 24px;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.rg-preview-placeholder {
    text-align: center;
    color: #64748b;
    padding: 40px;
    font-size: 16px;
}

@media (max-width: 1080px) {
    .rg-resume-container {
        flex-direction: column;
    }

    .rg-editor-panel,
    .rg-preview-panel {
        max-width: 100%;
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .rg-resume-builder {
        padding: 14px;
        border-radius: 14px;
    }

    .rg-resume-title {
        font-size: 22px;
    }

    .rg-toolbar {
        gap: 8px;
    }

    .rg-btn,
    .rg-template-selector {
        font-size: 13px;
    }

    .rg-field-grid {
        grid-template-columns: 1fr;
    }

    .rg-resume-preview {
        min-height: auto;
        padding: 20px;
    }

    .rg-print-hint {
        border-radius: 12px;
        text-align: center;
    }
}
