/* ==========================================================================
   Calculadora de Plafón Reticular — Styles
   Prefix: rfc-
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. CSS Variables (design tokens)
   ------------------------------------------------------------------------- */
.rfc-container {
    --rfc-primary: #1e3a8a;
    --rfc-primary-hover: #1e40af;
    --rfc-accent: #f97316;
    --rfc-bg: #f8fafc;
    --rfc-bg-alt: #e2e8f0;
    --rfc-text: #1e293b;
    --rfc-text-light: #64748b;
    --rfc-border: #cbd5e1;
    --rfc-radius: 6px;
    --rfc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --rfc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --rfc-font-mono: 'SF Mono', 'Fira Code', monospace;

    font-family: var(--rfc-font);
    color: var(--rfc-text);
    background: var(--rfc-bg);
    padding: 24px;
    border-radius: var(--rfc-radius);
    max-width: 100%;
    margin: 0 auto;
    box-shadow: var(--rfc-shadow);
    box-sizing: border-box;
}

/* -------------------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------------------- */
.rfc-container *,
.rfc-container *::before,
.rfc-container *::after {
    box-sizing: border-box;
}

.rfc-container p {
    margin: 0;
}

/* -------------------------------------------------------------------------
   3. Business Header (hidden on screen, shown in PDF)
   ------------------------------------------------------------------------- */
.rfc-business-header {
    background: #fff;
    padding: 20px;
    border-bottom: 2px solid var(--rfc-primary);
    margin-bottom: 30px;
    display: none;
}

.rfc-biz-columns {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.rfc-biz-logo {
    width: 250px;
}

.rfc-biz-logo img {
    max-width: 250px;
    display: block;
}

.rfc-biz-info {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--rfc-text);
}

.rfc-quotation-meta {
    text-align: right;
}

.rfc-quotation-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rfc-primary);
    margin-bottom: 5px;
}

.rfc-date,
.rfc-currency {
    font-size: 0.9rem;
    color: var(--rfc-text-light);
}

/* -------------------------------------------------------------------------
   4. Screen Header
   ------------------------------------------------------------------------- */
.rfc-header {
    text-align: center;
    margin-bottom: 24px;
}

.rfc-header-brand img {
    max-width: 250px;
    display: block;
    margin: 0 auto 15px;
}

.rfc-header h2 {
    margin: 0 0 8px 0;
    color: var(--rfc-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.rfc-header p {
    margin: 0;
    color: var(--rfc-text-light);
    font-size: 0.95rem;
}

/* -------------------------------------------------------------------------
   5. Input Section
   ------------------------------------------------------------------------- */
.rfc-input-section {
    background: #fff;
    padding: 20px;
    border-radius: var(--rfc-radius);
    border: 1px solid var(--rfc-border);
    margin-bottom: 24px;
}

/* -------------------------------------------------------------------------
   6. Tabs
   ------------------------------------------------------------------------- */
.rfc-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--rfc-bg-alt);
}

.rfc-tab {
    background: transparent;
    border: none;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--rfc-text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s ease, border-color 0.2s ease;
    font-family: var(--rfc-font);
}

.rfc-tab:hover {
    color: var(--rfc-primary);
}

.rfc-tab.active {
    color: var(--rfc-primary);
    border-bottom-color: var(--rfc-accent);
}

/* -------------------------------------------------------------------------
   7. Input Groups
   ------------------------------------------------------------------------- */
.rfc-input-group {
    display: none;
}

.rfc-input-group.active {
    display: block;
}

.rfc-input-group label {
    display: block;
    margin-bottom: 6px;
    margin-top: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}

.rfc-input-group label:first-child {
    margin-top: 0;
}

.rfc-input-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rfc-border);
    border-radius: var(--rfc-radius);
    font-size: 1rem;
    font-family: var(--rfc-font);
    transition: border-color 0.2s ease;
}

.rfc-input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--rfc-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.rfc-dim-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rfc-dim-result {
    margin-top: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rfc-primary);
    background: rgba(30, 58, 138, 0.05);
    padding: 12px;
    border-radius: var(--rfc-radius);
    text-align: center;
}

/* -------------------------------------------------------------------------
   8. Options Row (waste, labor, IVA)
   ------------------------------------------------------------------------- */
.rfc-options-row {
    display: flex;
    align-items: center;
    margin-top: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.rfc-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rfc-option label {
    font-size: 0.85rem;
    color: var(--rfc-text-light);
    white-space: nowrap;
}

.rfc-option select,
.rfc-option input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--rfc-border);
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
    font-family: var(--rfc-font);
}

.rfc-option input[type="number"] {
    width: 100px;
}

.rfc-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.rfc-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* -------------------------------------------------------------------------
   9. SVG Container
   ------------------------------------------------------------------------- */
.rfc-svg-container {
    background: #fff;
    border: 1px solid var(--rfc-border);
    border-radius: var(--rfc-radius);
    padding: 20px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, #fcfcfc, #f1f5f9);
    margin-bottom: 24px;
}

.rfc-svg-container svg {
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.1));
}

.rfc-svg-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--rfc-text-light);
    font-style: italic;
}

/* -------------------------------------------------------------------------
   10. Results Section
   ------------------------------------------------------------------------- */
.rfc-results {
    background: #fff;
    padding: 24px;
    border-radius: var(--rfc-radius);
    border: 1px solid var(--rfc-border);
    margin-bottom: 24px;
}

.rfc-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rfc-results-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--rfc-primary);
}

.rfc-area-badge {
    background: var(--rfc-accent);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rfc-wire-badge {
    background: var(--rfc-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* -------------------------------------------------------------------------
   11. Table
   ------------------------------------------------------------------------- */
.rfc-table-wrapper {
    overflow-x: auto;
}

.rfc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rfc-table th {
    background: var(--rfc-bg);
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--rfc-text);
    border-bottom: 2px solid var(--rfc-border);
    font-size: 0.85rem;
}

.rfc-table td {
    padding: 8px;
    border-bottom: 1px solid var(--rfc-border);
}

.rfc-table th:nth-child(1),
.rfc-table td:nth-child(1) {
    width: 42%;
}

.rfc-table th:nth-child(2),
.rfc-table td:nth-child(2) {
    width: 12%;
    text-align: center;
}

.rfc-table th:nth-child(3),
.rfc-table td:nth-child(3) {
    width: 12%;
    text-align: center;
}

.rfc-table th:nth-child(4),
.rfc-table td:nth-child(4) {
    width: 17%;
    text-align: right;
}

.rfc-table th:nth-child(5),
.rfc-table td:nth-child(5) {
    width: 17%;
    text-align: right;
}

.rfc-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

/* panel box note in table (box count shown below panel name) */
.rfc-pdf-note {
    display: block;
    font-size: 0.78rem;
    color: var(--rfc-text-light);
    font-style: italic;
    line-height: 1.3;
}

/* -------------------------------------------------------------------------
   12. Footer Rows (subtotal, labor, IVA, grand total)
   ------------------------------------------------------------------------- */
.rfc-text-right {
    text-align: right !important;
}

.rfc-font-bold {
    font-weight: 600;
}

.rfc-summary-row td {
    background: var(--rfc-bg);
    font-weight: 600;
    padding: 10px 8px;
}

.rfc-grand-total td {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--rfc-primary);
    border-top: 2px solid var(--rfc-border);
    background: rgba(30, 58, 138, 0.05);
    padding: 10px 8px;
}

/* -------------------------------------------------------------------------
   13. Footer Notes & Tutorial Box
   ------------------------------------------------------------------------- */
.rfc-footer-notes {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--rfc-text-light);
    font-style: italic;
    border-top: 1px solid var(--rfc-border);
    padding-top: 12px;
}

.rfc-footer-notes p {
    margin: 0 0 4px;
}

.rfc-tutorial-box {
    margin-top: 15px;
    background: #fff;
    border: 1px solid var(--rfc-accent);
    padding: 12px;
    border-radius: var(--rfc-radius);
    text-align: center;
    font-style: normal;
}

.rfc-tutorial-box a {
    color: var(--rfc-accent);
    text-decoration: none;
    font-weight: 600;
}

.rfc-tutorial-box a:hover {
    text-decoration: underline;
}

/* -------------------------------------------------------------------------
   14. PDF Button
   ------------------------------------------------------------------------- */
.rfc-actions {
    text-align: right;
}

.rfc-btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rfc-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--rfc-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--rfc-font);
    transition: background 0.2s ease, transform 0.1s ease;
}

.rfc-btn-pdf:hover {
    background: var(--rfc-primary-hover);
}

.rfc-btn-pdf:active {
    transform: scale(0.98);
}

/* -------------------------------------------------------------------------
   15. Responsive — max-width 600px
   ------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .rfc-container {
        padding: 16px;
    }

    .rfc-dim-row {
        grid-template-columns: 1fr;
    }

    .rfc-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .rfc-options-row {
        flex-direction: column;
        align-items: stretch;
    }

    .rfc-option {
        flex-direction: column;
        align-items: stretch;
    }

    .rfc-option input[type="number"] {
        width: 100%;
    }

    .rfc-business-header {
        display: none;
    }

    .rfc-table {
        font-size: 0.8rem;
    }

    .rfc-table th,
    .rfc-table td {
        padding: 6px 4px;
    }

    .rfc-table th:nth-child(1),
    .rfc-table td:nth-child(1) {
        width: 36%;
    }

    .rfc-table th:nth-child(2),
    .rfc-table td:nth-child(2),
    .rfc-table th:nth-child(3),
    .rfc-table td:nth-child(3) {
        width: 10%;
    }

    .rfc-table th:nth-child(4),
    .rfc-table td:nth-child(4),
    .rfc-table th:nth-child(5),
    .rfc-table td:nth-child(5) {
        width: 22%;
    }

    .rfc-btn-pdf {
        width: 100%;
        justify-content: center;
    }

    .rfc-header-brand img {
        max-width: 180px;
    }
}

/* -------------------------------------------------------------------------
   16. Print Styles
   ------------------------------------------------------------------------- */
@media print {
    /* Hide interactive / screen-only elements */
    .rfc-header,
    .rfc-input-section,
    .rfc-tabs,
    .rfc-options-row,
    .rfc-svg-container,
    .rfc-actions,
    .rfc-btn-pdf,
    .rfc-tutorial-box,
    .rfc-footer-notes {
        display: none !important;
    }

    /* Hide global WP / theme elements */
    #wpadminbar,
    header,
    footer,
    nav,
    .sidebar,
    aside {
        display: none !important;
    }

    /* Reset container for print */
    .rfc-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        background: none !important;
    }

    /* Show business header in print */
    .rfc-business-header {
        display: block !important;
        margin-bottom: 25px !important;
        padding-bottom: 15px !important;
        border-bottom: 2px solid #1e3a8a !important;
    }

    /* Adjust results section for print */
    .rfc-results {
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: none !important;
    }

    /* Table adjustments for print */
    .rfc-table {
        font-size: 9pt;
        width: 100%;
    }

    .rfc-table th,
    .rfc-table td {
        padding: 3px 6px;
    }

    .rfc-table th {
        background: #f1f5f9 !important;
    }

    .rfc-summary-row td {
        background: #f8fafc !important;
    }

    .rfc-grand-total td {
        color: #1e3a8a !important;
        background: rgba(30, 58, 138, 0.05) !important;
    }

    /* Ensure colors print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Page setup */
    @page {
        size: letter;
        margin: 1.2cm;
    }

    body {
        margin: 0;
        padding: 0;
    }
}
