/* ================================================================
   Times Audio Quotation Builder — Frontend Styles
   ================================================================ */

/* Reset & Base */
#ta-qb-app * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#ta-qb-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333333;
    background: #F2F2F7;
    min-height: 100vh;
}

/* ================================================================
   PASSWORD GATE
   ================================================================ */

#ta-qb-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f8f8 0%, #efefef 100%);
}

.ta-gate-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 4px 40px rgba(0,0,0,0.08);
}

.ta-gate-logo {
    max-width: 160px;
    height: auto;
    margin-bottom: 24px;
}

.ta-gate-card h2 {
    font-size: 22px;
    font-weight: 600;
    color: #111;
    margin-bottom: 8px;
}

.ta-gate-card p {
    color: #666;
    margin-bottom: 24px;
}

.ta-gate-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ta-gate-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.ta-gate-form input:focus {
    border-color: #111;
}

.ta-gate-form button {
    width: 100%;
    padding: 14px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ta-gate-form button:hover {
    background: #333;
}

.ta-gate-error {
    color: #c0392b;
    font-size: 13px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #fdecea;
    border-radius: 8px;
}

/* ================================================================
   STICKY BAR
   ================================================================ */

#ta-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.ta-sticky-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.ta-sticky-brand img {
    height: 36px;
    width: auto;
}

.ta-sticky-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ================================================================
   BUILDER LAYOUT
   ================================================================ */

#ta-qb-builder {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.ta-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.ta-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.ta-section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.ta-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 20px 0;
}

/* ================================================================
   LETTERHEAD
   ================================================================ */

.ta-header-card {
    background: linear-gradient(to bottom, #fff, #fafafa);
}

.ta-letterhead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.ta-letterhead-logo img {
    max-width: 180px;
    height: auto;
}

.ta-letterhead-info {
    text-align: right;
}

.ta-info-line {
    font-size: 12.5px;
    color: #555;
    line-height: 1.8;
}

.ta-info-line strong {
    color: #111;
}

.ta-client-info {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */

.ta-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ta-field-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
}

.ta-field-group input,
.ta-field-group textarea {
    border: none;
    border-bottom: 1.5px solid #e8e8e8;
    padding: 8px 0;
    font-size: 15px;
    font-family: inherit;
    color: #111;
    background: transparent;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
    width: 100%;
}

.ta-field-group input:focus,
.ta-field-group textarea:focus {
    border-bottom-color: #111;
}

/* ================================================================
   MODE TOGGLE
   ================================================================ */

.ta-mode-toggle {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.ta-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    font-weight: 500;
}

.ta-radio-label input[type="radio"] {
    accent-color: #111;
    width: 15px;
    height: 15px;
}

/* ================================================================
   TABLES
   ================================================================ */

.ta-table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #efefef;
}

.ta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ta-table th {
    background: #F5F5F5;
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
}

.ta-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
}

.ta-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.ta-table tbody tr:hover {
    background: #f5f7ff;
}

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

/* Editable cells */
.ta-table td input,
.ta-table td textarea {
    border: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: #333;
    outline: none;
    width: 100%;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

.ta-table td input:focus,
.ta-table td textarea:focus {
    border-bottom-color: #ccc;
}

.ta-table td input[type="number"] {
    -moz-appearance: textfield;
}

.ta-table td input[type="number"]::-webkit-outer-spin-button,
.ta-table td input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.ta-img-cell {
    width: 64px;
}

.ta-img-preview {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
    display: block;
    cursor: pointer;
}

.ta-img-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    border: 1.5px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ta-img-placeholder:hover {
    border-color: #999;
    color: #999;
}

.ta-amount-cell {
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    min-width: 90px;
}

.ta-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.ta-delete-btn:hover {
    color: #e74c3c;
}

/* ================================================================
   TABLE ACTIONS
   ================================================================ */

.ta-table-actions {
    margin-top: 12px;
}

/* ================================================================
   BUTTONS
   ================================================================ */

.ta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1;
    font-family: inherit;
}

.ta-btn-primary {
    background: #111;
    color: #fff;
}

.ta-btn-primary:hover {
    background: #333;
}

.ta-btn-secondary {
    background: #F0F0F0;
    color: #333;
}

.ta-btn-secondary:hover {
    background: #e0e0e0;
}

.ta-btn-accent {
    background: #0071e3;
    color: #fff;
}

.ta-btn-accent:hover {
    background: #0077ed;
}

.ta-btn-danger {
    background: #fff0f0;
    color: #c0392b;
}

.ta-btn-danger:hover {
    background: #ffe0e0;
}

/* ================================================================
   TOGGLE CONTROLS
   ================================================================ */

.ta-toggle-header {
    display: flex;
    align-items: center;
}

.ta-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

.ta-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #111;
    cursor: pointer;
}

.ta-toggle-text {
    font-size: 15px;
    font-weight: 600;
}

/* ================================================================
   ACOUSTICS INPUTS
   ================================================================ */

.ta-acoustics-inputs {
    background: #fafafa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

.ta-input-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ta-field-group-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.ta-field-group-inline label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
}

.ta-field-group-inline input {
    border: none;
    border-bottom: 1.5px solid #e8e8e8;
    padding: 8px 0;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    background: transparent;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

.ta-field-group-inline input:focus {
    border-bottom-color: #111;
}

.ta-btn-toggle-group {
    display: flex;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.ta-btn-toggle {
    padding: 8px 16px;
    border: none;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: #666;
    transition: all 0.2s;
}

.ta-btn-toggle.active {
    background: #111;
    color: #fff;
}

.ta-btn-toggle:not(.active):hover {
    background: #f5f5f5;
}

/* ================================================================
   LUMP SUM
   ================================================================ */

.ta-lumpsum {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 14px 16px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.ta-lumpsum label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.ta-lumpsum input {
    border: none;
    border-bottom: 1.5px solid #ccc;
    padding: 4px 0;
    font-size: 15px;
    font-family: inherit;
    color: #111;
    background: transparent;
    outline: none;
    width: 180px;
    transition: border-color 0.2s;
}

.ta-lumpsum input:focus {
    border-bottom-color: #111;
}

/* ================================================================
   SUMMARY BOX
   ================================================================ */

.ta-summary-box {
    margin-top: 16px;
    text-align: right;
}

.ta-summary-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 32px;
    padding: 6px 0;
}

.ta-summary-row span:first-child {
    font-size: 13px;
    color: #777;
    min-width: 160px;
    text-align: right;
}

.ta-summary-row span:last-child {
    font-size: 14px;
    color: #111;
    font-weight: 600;
    min-width: 120px;
    text-align: right;
}

.ta-summary-row.ta-grand-row span:last-child {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.ta-summary-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 0 8px auto;
    width: 320px;
}

/* ================================================================
   GRAND TOTAL CARD
   ================================================================ */

.ta-grand-total-card {
    text-align: right;
}

.ta-grand-total-number {
    font-size: 32px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
}

.ta-grand-total-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
    margin-bottom: 8px;
}

/* ================================================================
   MODALS
   ================================================================ */

.ta-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ta-modal-inner {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.ta-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.ta-modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #111;
}

.ta-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ta-modal-close:hover {
    background: #f5f5f5;
}

.ta-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ta-select-styled {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}

.ta-select-styled:focus {
    border-color: #111;
}

.ta-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ================================================================
   TOAST
   ================================================================ */

.ta-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 99999;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    transition: opacity 0.3s;
    max-width: 420px;
    text-align: center;
}

.ta-toast.ta-toast-error {
    background: #c0392b;
}

.ta-toast.ta-toast-success {
    background: #27ae60;
}

/* ================================================================
   IMAGE MODAL
   ================================================================ */

.ta-img-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ta-img-modal-inner {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ta-img-modal-inner h4 {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

.ta-img-modal-inner input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.ta-img-modal-inner input:focus {
    border-color: #111;
}

.ta-img-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
    .ta-sticky-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .ta-letterhead {
        flex-direction: column;
    }

    .ta-letterhead-info {
        text-align: left;
    }

    .ta-client-info {
        grid-template-columns: 1fr;
    }

    .ta-input-row {
        flex-direction: column;
    }

    #ta-qb-builder {
        padding: 16px 12px 40px;
    }

    .ta-card {
        padding: 18px;
    }

    .ta-summary-row {
        gap: 16px;
    }
}

/* ================================================================
   UTILITIES
   ================================================================ */

.ta-hidden {
    display: none !important;
}

.ta-text-right {
    text-align: right;
}

.ta-font-mono {
    font-variant-numeric: tabular-nums;
}
