/* ==========================================================================
   assets/css/public_themes.css - Unified Public Theme System for OrbitFlow
   ========================================================================== */

/* ==========================================================================
   1. CSS VARIABLES (Light Theme Default)
   ========================================================================== */
:root {
    /* Brand Colors (Dynamic overrides applied in HTML/PHP headers if needed) */
    --primary: #4f46e5;
    --primary-rgb: 79, 70, 229;
    --primary-light: rgba(var(--primary-rgb), 0.08);
    
    /* System & Canvas */
    --bg-page: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --bg-input: #ffffff;
    
    /* Typography Colors */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    
    /* Semantic Actions */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Shadows & Radii */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ==========================================================================
   2. DARK & SYSTEM THEME OVERRIDES
   ========================================================================== */
.theme-dark,
.dark-mode {
    --bg-page: #0f172a;
    --surface: #1e293b;
    --surface-2: #0f172a;
    --bg-input: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    .theme-system {
        --bg-page: #0f172a;
        --surface: #1e293b;
        --surface-2: #0f172a;
        --bg-input: #334155;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    }
}

/* ==========================================================================
   3. BASE RESET & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    margin: 0;
    padding: 40px 20px;
    line-height: 1.5;
    transition: background 0.3s, color 0.3s;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   4. LAYOUT CONTAINERS & TOOLBARS
   ========================================================================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.controls {
    margin-bottom: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   5. UNIFIED BUTTONS SYSTEM
   ========================================================================== */
.btn,
.pm-btn,
.btn-submit,
.btn-again {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn:hover,
.pm-btn:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary,
.btn-submit,
.btn-again {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.btn-primary:hover,
.btn-submit:hover,
.btn-again:hover {
    background: var(--primary);
    opacity: 0.92;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:active,
.btn-submit:active,
.btn-again:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
}
.btn-success:hover {
    background: var(--success);
    opacity: 0.9;
    color: #ffffff;
}

.btn-warning {
    background: var(--warning);
    color: #ffffff;
    border-color: var(--warning);
}
.btn-warning:hover {
    background: var(--warning);
    opacity: 0.9;
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    opacity: 0.9;
    color: #ffffff;
}

.btn-icon-sm,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    text-decoration: none;
}

.btn-icon-sm:hover,
.icon-button:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.theme-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-main);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 999;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   6. CARDS (Invoice, Proposal, Public Doc)
   ========================================================================== */
.invoice-card,
.proposal-card,
.document {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px 48px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s, border-color 0.3s;
}

/* Paid Watermark Stamp */
.paid-stamp {
    position: absolute;
    top: 40px;
    right: -40px;
    background: var(--success);
    color: white;
    padding: 8px 80px;
    transform: rotate(45deg);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 2px;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    z-index: 10;
}

[dir="rtl"] .paid-stamp {
    right: auto;
    left: -40px;
    transform: rotate(-45deg);
}

/* ==========================================================================
   7. HEADERS & LOGO SECTIONS
   ========================================================================== */
.header,
.proposal-header,
.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.logo-section img {
    max-height: 56px;
    width: auto;
}

.logo-section .brand {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--primary);
}

.title-section,
.meta-info {
    text-align: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invoice-eyebrow,
.document-kind {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.title-section h1,
.meta-info h1 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.1;
}

.title-section .ref,
.meta-info .ref {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Document Specific Metadata */
.document-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: end;
}

.document-meta div {
    margin-bottom: 2px;
}

.document-meta div:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   8. METADATA & INFORMATION GRIDS
   ========================================================================== */
.details-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    margin-bottom: 24px;
    gap: 20px;
}

.info-block h4 {
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    margin: 0 0 8px;
    letter-spacing: 0.1em;
}

.info-block p {
    margin: 0 0 4px;
    line-height: 1.5;
}

.client-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.client-meta {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.info-block.date-status {
    background: var(--primary-light);
    border-inline-start: 4px solid var(--primary);
    padding: 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

[dir="rtl"] .info-block.date-status {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.info-block.date-status p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.info-block.date-status p:last-child {
    margin-bottom: 0;
}

.proposal-title {
    margin: 20px 0;
    padding: 12px 16px;
    background: var(--primary-light);
    border-inline-start: 4px solid var(--primary);
}

.proposal-title h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.35rem;
}

.proposal-body,
.document-content {
    line-height: 1.7;
    font-size: 1.05rem;
}

.proposal-body table,
.document-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.proposal-body td, .proposal-body th,
.document-content td, .document-content th {
    padding: 10px;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   9. TABLES & FINANCIAL SUMMARIES
   ========================================================================== */
.invoice-table-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
}

.invoice-table,
.invoices-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th,
.invoices-table th {
    text-align: end;
    padding: 12px 10px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.invoice-table td,
.invoices-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.invoice-table tr:last-child td {
    border-bottom: none;
}

.invoice-table th.col-index,
.invoice-table td.col-index {
    text-align: start;
    width: 44px;
}

.invoice-table th.col-qty,
.invoice-table td.col-qty {
    text-align: center;
    width: 60px;
}

.invoice-table th.col-price,
.invoice-table td.col-price,
.invoice-table th.col-total,
.invoice-table td.col-total {
    text-align: end;
    width: 110px;
}

.invoice-table .item-name {
    font-weight: 600;
    text-align: start;
}

.inv-tail {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.inv-tail .notes-section,
.inv-tail .summary-wrapper {
    flex: 1;
    min-width: 250px;
}

.inv-tail .summary-wrapper {
    display: flex;
    justify-content: flex-end;
}

.summary-table {
    width: 300px;
}

.summary-table tr td {
    padding: 6px 0;
}

.summary-table tr td:last-child {
    text-align: end;
    font-weight: 700;
}

.summary-table tr.total-row {
    color: var(--primary);
    font-size: 1.2rem;
    border-top: 2px solid var(--border-color);
}

.summary-table .discount-row {
    color: var(--danger);
}

/* ==========================================================================
   10. INTERACTIVE CLIENT PANELS
   ========================================================================== */
.payment-methods-section,
.action-panel {
    margin-top: 24px;
    padding: 24px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.payment-methods-section h3,
.action-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 1.1rem;
}

.payment-methods-list,
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-panel textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    margin-bottom: 16px;
    resize: vertical;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-note {
    padding: 16px;
    border-inline-start: 4px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.feedback-meta {
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.feedback-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
}

.footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer p {
    margin: 4px 0;
}

/* ==========================================================================
   11. FOUR INTEGRATED DESIGNS (Layout Handlers)
   ========================================================================== */

/* ----------------------------------------------------
   [Layout A]: Classic (Standard clean container styling)
   ---------------------------------------------------- */
.layout-classic .container {
    max-width: 900px;
}

/* ----------------------------------------------------
   [Layout B]: Editorial (Borderless with modern banners)
   ---------------------------------------------------- */
.layout-editorial .container {
    max-width: 1100px;
}

.layout-editorial .invoice-card,
.layout-editorial .proposal-card,
.layout-editorial .document {
    padding: 0 56px 48px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.layout-editorial .header,
.layout-editorial .proposal-header,
.layout-editorial .document-header {
    margin-inline: -56px;
    padding: 48px 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    border: 0;
}

.layout-editorial .header *,
.layout-editorial .proposal-header *,
.layout-editorial .document-header * {
    color: #ffffff !important;
}

.layout-editorial .invoice-status-pill,
.layout-editorial .status-badge {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.24);
}

.layout-editorial .document-meta {
    text-align: start;
    margin-top: 12px;
}

/* ----------------------------------------------------
   [Layout C]: Compact (Tighter grids and spacing)
   ---------------------------------------------------- */
.layout-compact .container {
    max-width: 760px;
}

.layout-compact .invoice-card,
.layout-compact .proposal-card,
.layout-compact .document {
    padding: 24px 28px;
}

.layout-compact .header,
.layout-compact .proposal-header,
.layout-compact .document-header {
    margin-bottom: 16px;
}

.layout-compact .details-grid {
    gap: 16px;
}

/* ----------------------------------------------------
   [Layout D]: Split (Left/Right asymmetrical visual layouts)
   ---------------------------------------------------- */
@media (min-width: 901px) {
    .layout-split .container {
        max-width: 1160px;
    }

    .layout-split .invoice-card,
    .layout-split .proposal-card,
    .layout-split .document {
        padding: 0;
        display: grid;
        grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
        overflow: hidden;
    }

    .layout-split .header,
    .layout-split .proposal-header,
    .layout-split .document-header {
        grid-column: 1;
        grid-row: 1 / span 20;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        margin: 0;
        padding: 48px 32px;
        height: 100%;
        min-height: 100%;
        background: linear-gradient(160deg, var(--primary), var(--primary-light));
        color: #ffffff;
        border: 0;
        border-radius: 0;
    }

    .layout-split .header *,
    .layout-split .proposal-header *,
    .layout-split .document-header * {
        color: #ffffff !important;
    }

    .layout-split .details-grid,
    .layout-split .invoice-intro,
    .layout-split .invoice-table-wrap,
    .layout-split .inv-tail,
    .layout-split .proposal-body,
    .layout-split .proposal-title,
    .layout-split .invoices-section,
    .layout-split .document-content,
    .layout-split .payment-methods-section,
    .layout-split .action-panel,
    .layout-split .footer {
        grid-column: 2;
        margin-inline: 40px;
    }
    
    .layout-split .details-grid,
    .layout-split .document-content {
        margin-top: 40px;
    }

    .layout-split .document-meta {
        text-align: start;
        margin-top: 12px;
    }
}

/* ==========================================================================
   12. PUBLIC FORM SPECIFIC STYLES (board_form.php)
   ========================================================================== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
    font-size: 0.875rem;
    color: var(--text-main);
}

.form-group label .required {
    color: var(--danger);
    margin-left: 3px;
}

.form-subdesc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: -4px;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-main);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.btn-submit:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.45);
}

.btn-submit:active {
    transform: translateY(0);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1.5px solid var(--danger);
    color: #b91c1c;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.theme-dark .error-message {
    color: #fca5a5;
}

/* Rating Stars */
.rating-stars-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.rating-stars-input input[type="radio"] {
    display: none;
}

.rating-stars-input label {
    font-size: 2rem;
    color: #d1d5db;
    cursor: pointer;
    margin: 0 !important;
    display: inline-block;
}

.rating-stars-input input[type="radio"]:checked ~ label,
.rating-stars-input label:hover,
.rating-stars-input label:hover ~ label {
    color: #fbbf24;
}

/* Checkbox List */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-list label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    margin: 0 !important;
    cursor: pointer;
}

.checkbox-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Cover strip */
.form-cover {
    width: 100%;
    height: 160px;
    background-color: var(--primary);
    background-size: cover;
    background-position: center;
    position: relative;
}

/* Titles */
.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-title i {
    font-size: 1.6rem;
    color: var(--primary);
}

.form-subtitle {
    margin: 0 0 4px 0;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
}

.form-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 12px 0 0 0;
}

/* Success Layout states */
.success-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    width: 100%;
    padding: 40px 20px;
}

.success-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    text-align: center;
    max-width: 540px;
    width: 100%;
    animation: slideUp 0.4s ease;
}

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 16px;
    display: block;
    animation: bounceIn 0.6s ease 0.2s both;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% { transform: scale(1.15); }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.success-card h2 {
    font-size: 1.6rem;
    margin: 0 0 12px 0;
}

.success-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.btn-again {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-again:hover {
    opacity: 0.88;
}

/* ==========================================================
   PUBLIC FORM LAYOUT SCHEMES (Classic, Minimal, Glass, Split)
   ========================================================== */

/* STYLE 1: CLASSIC CARD */
.form-style-classic .page-wrapper {
    width: 100%;
    max-width: 620px;
    margin: 40px auto;
    animation: slideUp 0.4s ease;
}

.form-style-classic .form-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.form-style-classic .form-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-style-classic .form-body {
    padding: 32px;
}

/* STYLE 2: MINIMAL */
.form-style-minimal body,
body.form-style-minimal {
    background-color: var(--surface-2);
}

.form-style-minimal .page-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 48px auto;
    padding: 0 16px;
    animation: slideUp 0.4s ease;
}

.form-style-minimal .form-container {
    background: transparent;
}

.form-style-minimal .form-cover {
    display: none;
}

.form-style-minimal .form-header {
    padding: 0 0 24px 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 28px;
}

.form-style-minimal .form-title {
    font-size: 1.7rem;
}

.form-style-minimal .form-body {
    padding: 0;
}

.form-style-minimal .form-control {
    border: none;
    border-bottom: 1.5px solid var(--border-color);
    border-radius: 0;
    padding: 10px 2px;
    background: transparent;
}

.form-style-minimal .form-control:focus {
    border-bottom-color: var(--primary);
    box-shadow: none;
}

.form-style-minimal .btn-submit {
    border-radius: var(--radius-sm);
}

/* STYLE 3: GLASSMORPHIC */
.form-style-glassmorphic .page-wrapper {
    width: 100%;
    max-width: 620px;
    margin: 40px auto;
    padding: 0 16px;
    animation: slideUp 0.4s ease;
}

.form-style-glassmorphic .form-container {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.form-style-glassmorphic .form-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.form-style-glassmorphic .form-title  { color: #fff; }
.form-style-glassmorphic .form-subtitle { color: rgba(255, 255, 255, 0.7); }
.form-style-glassmorphic .form-desc   { color: rgba(255, 255, 255, 0.6); }

.form-style-glassmorphic .form-body {
    padding: 32px;
}

.form-style-glassmorphic .form-group label {
    color: rgba(255, 255, 255, 0.9);
}

.form-style-glassmorphic .form-control {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.form-style-glassmorphic .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-style-glassmorphic .form-control:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.form-style-glassmorphic .form-group select.form-control option {
    background: #302b63;
    color: #fff;
}

.form-style-glassmorphic .error-message {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* STYLE 4: SPLIT LAYOUT */
body.form-style-split {
    align-items: stretch;
    padding: 0;
}

.form-style-split .page-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.form-style-split .form-info-pane {
    width: 42%;
    min-width: 300px;
    background: var(--primary);
    background-image: linear-gradient(160deg, var(--primary) 0%, rgba(0, 0, 0, 0.35) 100%);
    display: flex;
    flex-direction: column;
    padding: 48px 40px;
    position: sticky;
    top: 0;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

.form-style-split .form-info-pane::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
}

.form-style-split .form-info-pane::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.form-style-split .info-cover-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.form-style-split .info-logo {
    max-height: 48px;
    height: auto;
    max-width: 50%;
    margin-bottom: 24px;
}

.form-style-split .info-icon {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 16px;
}

.form-style-split .info-title {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.form-style-split .info-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 16px 0;
}

.form-style-split .info-desc {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    line-height: 1.7;
    flex: 1;
}

.form-style-split .info-footer {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-top: 32px;
}

.form-style-split .form-fields-pane {
    flex: 1;
    background: var(--surface-2);
    padding: 48px;
    overflow-y: auto;
    box-sizing: border-box;
}

.form-style-split .fields-inner {
    max-width: 520px;
}

.form-style-split .fields-pane-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 28px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-main);
}

.form-style-split .form-cover,
.form-style-split .form-container {
    display: none;
}

@media (max-width: 768px) {
    .form-style-split .page-wrapper {
        flex-direction: column;
    }

    .form-style-split .form-info-pane {
        width: 100%;
        min-height: auto;
        position: relative;
        padding: 32px 24px;
    }

    .form-style-split .form-fields-pane {
        padding: 32px 20px;
    }
}

/* ==========================================================================
   14. PUBLIC LABEL COMPONENT ADAPTATIONS
   ========================================================================== */

/* --- Glassmorphic Form Adaptations --- */
.form-style-glassmorphic .of-multiselect-input-wrapper,
.form-style-glassmorphic .of-pill-btn,
.form-style-glassmorphic .of-multiselect-dropdown {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

.form-style-glassmorphic .of-multiselect-search {
    color: #ffffff !important;
}

.form-style-glassmorphic .of-multiselect-option {
    color: #ffffff !important;
}

.form-style-glassmorphic .of-multiselect-option:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.form-style-glassmorphic .of-multiselect-option.selected {
    background: rgba(var(--primary-rgb), 0.3) !important;
    color: #ffffff !important;
}

.form-style-glassmorphic .of-pill-btn.selected {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* --- Minimal Form Adaptations --- */
.form-style-minimal .of-multiselect-input-wrapper {
    border: none !important;
    border-bottom: 1.5px solid var(--border-color) !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding-left: 2px !important;
}

.form-style-minimal .of-multiselect-input-wrapper.focus {
    border-bottom-color: var(--primary) !important;
    box-shadow: none !important;
}

/* ==========================================================================
   13. RESPONSIVE MEDIA QUERIES & PRINT OPTIMIZATION
   ========================================================================== */
@media (max-width: 900px) {
    body {
        padding: 20px 10px;
    }
    
    .invoice-card,
    .proposal-card,
    .document {
        padding: 28px 24px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
        background: var(--surface);
    }
    
    .controls {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-color);
        background: var(--surface);
    }

    .invoice-card,
    .proposal-card,
    .document {
        padding: 24px 16px;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    
    .header,
    .proposal-header,
    .document-header,
    .inv-tail {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .document-meta {
        text-align: start;
        margin-top: 8px;
    }

    .inv-tail .summary-wrapper {
        justify-content: stretch;
        width: 100%;
    }
    
    .summary-table {
        width: 100%;
    }
}

/* ==========================================================================
   13b. STRICT PRINT-READY RESETS (Compact A4 Grayscale Outputs)
   ========================================================================== */
@media print {
    /* 1. تهيئة مساحة الطباعة وحجم الخطوط لتكون compact وموفرة للمساحة */
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        font-size: 9.5pt !important; /* حجم خط مثالي وموفر للمساحة */
        line-height: 1.3 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* 2. تصغير حجم العناوين والشعار لتوفير الارتفاع الرأسي */
    h1, .layout-split .title-section h1, .layout-editorial .title-section h1 {
        font-size: 15pt !important;
        margin-bottom: 4px !important;
    }
    h2, .proposal-title h2 {
        font-size: 12pt !important;
        margin: 0 0 4px 0 !important;
    }
    h3 {
        font-size: 10pt !important;
        margin: 0 0 4px 0 !important;
    }
    h4 {
        font-size: 8.5pt !important;
        margin: 0 0 3px 0 !important;
    }
    .brand {
        font-size: 15pt !important;
    }
    .logo-section img {
        max-height: 40px !important; /* تصغير حجم الشعار عند الطباعة */
    }

    /* 3. إخفاء كافة العناصر التفاعلية وأزرار التحكم بالكامل */
    .controls,
    .payment-methods-section,
    .action-panel,
    .theme-toggle-btn,
    .public-actions-container,
    #theme-toggle {
        display: none !important;
    }
    
    /* 4. إزالة الفراغات وهوامش الحواف للبطاقات وجعلها ممتدة */
    .container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .invoice-card,
    .proposal-card,
    .document {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        display: block !important;
        position: relative !important;
        overflow: visible !important;
    }

    /* 5. ضغط شبكة بيانات العميل والتواريخ لتقليل الارتفاع */
    .details-grid {
        display: grid !important;
        grid-template-columns: 1.2fr 0.8fr !important;
        margin-bottom: 12px !important;
        gap: 15px !important;
    }
    .info-block {
        margin-bottom: 6px !important;
        padding: 0 !important;
    }
    .info-block p {
        line-height: 1.3 !important;
        margin-bottom: 2px !important;
    }
    .client-name {
        font-size: 11pt !important;
        margin-bottom: 2px !important;
    }
    .client-meta {
        margin-top: 2px !important;
        font-size: 8.5pt !important;
    }
    .info-block.date-status {
        padding: 6px 10px !important;
        border-inline-start-width: 3px !important;
    }
    .info-block.date-status p {
        margin-bottom: 2px !important;
    }

    /* 6. تسوية وتصفير شبكات العرض المنقسمة (Split Grid) لتظهر مسطحة */
    .layout-split .invoice-card,
    .layout-split .proposal-card,
    .layout-split .document {
        display: block !important;
        grid-template-columns: none !important;
    }

    .layout-split .header,
    .layout-split .proposal-header,
    .layout-split .document-header {
        grid-column: auto !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin: 0 0 15px 0 !important;
        padding: 0 0 6px 0 !important;
        background: none !important;
        color: #000000 !important;
        border-bottom: 1.5px solid #cbd5e1 !important;
        height: auto !important;
        min-height: auto !important;
    }

    .layout-split .header *,
    .layout-split .proposal-header *,
    .layout-split .document-header * {
        color: #000000 !important;
    }

    .layout-split .details-grid,
    .layout-split .invoice-intro,
    .layout-split .invoice-table-wrap,
    .layout-split .inv-tail,
    .layout-split .proposal-body,
    .layout-split .proposal-title,
    .layout-split .invoices-section,
    .layout-split .document-content,
    .layout-split .payment-methods-section,
    .layout-split .action-panel,
    .layout-split .footer {
        grid-column: auto !important;
        margin-inline: 0 !important;
        margin: 0 0 10px 0 !important;
        padding: 0 !important;
    }

    .layout-split .proposal-title h2 {
        color: #000000 !important;
    }

    /* تسوية هوامش التصميم التحريري (Editorial Layout) */
    .layout-editorial .invoice-card,
    .layout-editorial .proposal-card,
    .layout-editorial .document {
        padding: 0 !important;
    }

    .layout-editorial .header,
    .layout-editorial .proposal-header,
    .layout-editorial .document-header {
        margin: 0 0 15px 0 !important;
        padding: 0 0 6px 0 !important;
        background: none !important;
        color: #000000 !important;
        border-bottom: 1.5px solid #cbd5e1 !important;
    }

    .layout-editorial .header *,
    .layout-editorial .proposal-header *,
    .layout-editorial .document-header * {
        color: #000000 !important;
    }

    /* 7. ضغط خلايا الجداول بنسبة عالية لتوفير المساحة الرأسية */
    table, .invoice-table, .invoices-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 12px !important;
        page-break-inside: auto !important;
    }

    tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }

    thead {
        display: table-header-group !important;
    }

    th, td {
        border-bottom: 1px solid #cbd5e1 !important;
        color: #000000 !important;
        padding: 5px 6px !important; /* مسافات داخلية ضيقة جداً ومثالية للطباعة */
        font-size: 9pt !important;
    }

    th {
        font-weight: 700 !important;
        background-color: #f1f5f9 !important; /* خلفية رمادية خفيفة جداً لتمييز رأس الجدول */
    }

    /* 8. ضغط الملاحظات وملخص الحسابات في الأسفل لضمان بقائها في صفحة واحدة */
    .inv-tail {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 15px !important;
        margin-top: 8px !important;
    }
    .inv-tail .notes-section, .inv-tail .summary-wrapper {
        min-width: 200px !important;
    }
    .notes-section p {
        font-size: 8.5pt !important;
        line-height: 1.3 !important;
    }
    .summary-table {
        width: 240px !important;
        margin-top: 0 !important;
    }
    .summary-table tr td {
        padding: 3px 0 !important;
        font-size: 9pt !important;
    }
    .summary-table tr.total-row {
        font-size: 11pt !important;
        border-top: 1.5px solid #000000 !important;
    }

    /* 9. تصغير هوامش الفوتر التذييلي */
    .footer {
        margin-top: 12px !important;
        padding-top: 6px !important;
        font-size: 8pt !important;
    }
    .footer p {
        margin: 2px 0 !important;
    }
    .footer .footer-note {
        margin-top: 2px !important;
        font-size: 7.5pt !important;
    }

    /* 10. تعديل الختم وإبقائه في موقع مناسب خفيف التفاصيل */
    .paid-stamp {
        border: 3px solid #10b981 !important;
        color: #10b981 !important;
        background: transparent !important;
        box-shadow: none !important;
        opacity: 0.6 !important;
        top: 10px !important;
        right: -45px !important;
        font-size: 13pt !important;
        padding: 4px 60px !important;
    }
    [dir="rtl"] .paid-stamp {
        right: auto !important;
        left: -45px !important;
    }
}