/**
 * VeraCita Financial Audit - Report Generator Styles
 */

/* ============================================
   Layout
   ============================================ */

.report-generator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--audit-bg, #f8fafc);
    min-height: 100vh;
    color: var(--audit-text, #1e293b);
}

/* ============================================
   Header
   ============================================ */

.rg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: white;
    border-bottom: 1px solid var(--audit-border, #e2e8f0);
}

.rg-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rg-header-left h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.rg-header-left h1 svg {
    width: 24px;
    height: 24px;
    color: var(--audit-primary, #1a56db);
}

.rg-header-right {
    display: flex;
    gap: 12px;
}

/* ============================================
   Content - List View
   ============================================ */

.rg-content {
    padding: 24px 32px;
}

.rg-templates,
.rg-reports {
    margin-bottom: 32px;
}

.rg-templates h3,
.rg-reports h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--audit-text-muted, #64748b);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: var(--audit-primary, #1a56db);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.1);
}

.template-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--audit-bg, #f8fafc);
    border-radius: 8px;
    color: var(--audit-primary, #1a56db);
}

.template-icon svg {
    width: 24px;
    height: 24px;
}

.template-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.template-ref {
    font-size: 12px;
    color: var(--audit-text-muted, #64748b);
}

/* Report List */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.report-item:hover {
    border-color: var(--audit-primary, #1a56db);
}

.report-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--audit-bg, #f8fafc);
    border-radius: 6px;
    color: var(--audit-text-muted, #64748b);
}

.report-item-icon svg {
    width: 20px;
    height: 20px;
}

.report-item-info {
    flex: 1;
}

.report-item-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.report-item-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--audit-text-muted, #64748b);
}

.report-item-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-draft { background: #f1f5f9; color: #64748b; }
.status-review { background: #fef3c7; color: #b45309; }
.status-approved { background: #d1fae5; color: #047857; }
.status-issued { background: #dbeafe; color: #1d4ed8; }

.report-item-actions {
    display: flex;
    gap: 6px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--audit-text-muted, #64748b);
}

/* ============================================
   Editor
   ============================================ */

.rg-editor {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    padding: 24px 32px;
}

.editor-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editor-section {
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 10px;
    padding: 24px;
}

.editor-section h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.form-group label.required::after {
    content: ' *';
    color: var(--audit-danger, #dc2626);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--audit-primary, #1a56db);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Opinion Options */
.opinion-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.opinion-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--audit-bg, #f8fafc);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.opinion-option:hover {
    background: white;
    border-color: var(--audit-border, #e2e8f0);
}

.opinion-option.selected {
    background: white;
    border-color: var(--audit-primary, #1a56db);
}

.opinion-option input {
    display: none;
}

.opinion-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ============================================
   Editor Sidebar
   ============================================ */

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 10px;
    padding: 20px;
}

.sidebar-section h3 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
}

.section-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--audit-bg, #f8fafc);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.section-item:hover {
    background: var(--audit-bg-hover, #f1f5f9);
}

.section-item input {
    margin: 0;
}

.required-badge {
    margin-left: auto;
    font-size: 10px;
    color: var(--audit-text-muted, #64748b);
    text-transform: uppercase;
}

.finding-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.finding-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--audit-bg, #f8fafc);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.finding-item:hover {
    background: var(--audit-bg-hover, #f1f5f9);
}

.finding-severity {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.finding-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Preview
   ============================================ */

.preview-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 100%);
    color: white;
}

.preview-header .btn-icon {
    color: white;
}

.preview-header .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.preview-container {
    padding: 32px;
    display: flex;
    justify-content: center;
    background: #64748b;
    min-height: calc(100vh - 80px);
}

.preview-document {
    background: white;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.doc-page {
    padding: 60px 80px;
    min-height: 1000px;
    border-bottom: 1px dashed #e2e8f0;
}

.doc-page:last-child {
    border-bottom: none;
}

/* Cover Page */
.cover-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.cover-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 80px;
}

.cover-header svg {
    width: 32px;
    height: 32px;
    color: #dc2626;
}

.company-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--audit-primary, #1a56db);
}

.cover-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--audit-text, #1e293b);
    margin: 0 0 12px 0;
}

.cover-title .legal-ref {
    font-size: 14px;
    color: var(--audit-text-muted, #64748b);
}

.cover-client {
    margin: 60px 0;
}

.cover-client h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.cover-client p {
    color: var(--audit-text-muted, #64748b);
}

.cover-period,
.cover-date {
    font-size: 14px;
    color: var(--audit-text-muted, #64748b);
}

/* Opinion Section */
.doc-page h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--audit-primary, #1a56db);
}

.opinion-badge {
    display: inline-block;
    padding: 8px 20px;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
}

.opinion-text p {
    font-size: 14px;
    line-height: 1.8;
    margin: 0 0 16px 0;
    text-align: justify;
}

/* Findings Section */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.finding-entry {
    padding: 16px 20px;
    background: var(--audit-bg, #f8fafc);
    border-left: 4px solid var(--audit-primary, #1a56db);
    border-radius: 0 8px 8px 0;
}

.finding-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.finding-number {
    font-weight: 700;
    color: var(--audit-primary, #1a56db);
}

.finding-entry .finding-title {
    flex: 1;
    font-weight: 600;
}

.finding-severity-badge {
    padding: 2px 10px;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.finding-area {
    margin: 0;
    font-size: 13px;
    color: var(--audit-text-muted, #64748b);
}

/* Signature Page */
.signature-page {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.signature-block {
    margin-top: auto;
}

.signature-location {
    font-size: 14px;
    margin: 0 0 8px 0;
}

.signature-company {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 40px 0;
}

.signatures {
    display: flex;
    gap: 80px;
}

.signature-line {
    min-width: 200px;
}

.signature-name {
    padding-top: 60px;
    border-top: 1px solid #333;
    font-weight: 600;
    margin-bottom: 4px;
}

.signature-role {
    font-size: 13px;
    color: var(--audit-text-muted, #64748b);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--audit-primary, #1a56db);
    color: white;
}

.btn-primary:hover {
    background: var(--audit-primary-dark, #1e40af);
}

.btn-secondary {
    background: white;
    color: var(--audit-text, #1e293b);
    border: 1px solid var(--audit-border, #e2e8f0);
}

.btn-secondary:hover {
    background: var(--audit-bg-hover, #f1f5f9);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--audit-text-muted, #64748b);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--audit-bg-hover, #f1f5f9);
    color: var(--audit-primary, #1a56db);
}

.btn-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .rg-editor {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-section {
        flex: 1;
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .rg-header,
    .rg-content,
    .rg-editor {
        padding-left: 16px;
        padding-right: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

    .preview-container {
        padding: 16px;
    }

    .doc-page {
        padding: 30px 20px;
    }

    .signatures {
        flex-direction: column;
        gap: 40px;
    }
}

@media print {
    .rg-header,
    .preview-header {
        display: none;
    }

    .preview-container {
        padding: 0;
        background: white;
    }

    .preview-document {
        box-shadow: none;
    }

    .doc-page {
        page-break-after: always;
    }
}
