/**
 * Authorization Form Styles
 *
 * Miami-Dade compliant authorization form styling
 * for body shop client sites.
 *
 * @package S2F_Theme
 * @since 3.0.0
 */

/* ===========================
   CSS Variables
   =========================== */
:root {
    --auth-primary: #c83232;
    --auth-primary-dark: #a02828;
    --auth-secondary: #5e6260;
    --auth-text: #333333;
    --auth-text-light: #666666;
    --auth-border: #cccccc;
    --auth-bg-light: #f2f4ff;
    --auth-bg-white: #ffffff;
    --auth-success: #248569;
    --auth-error: #dc3545;
    --auth-warning: #ffc107;
}

/* ===========================
   Form Container
   =========================== */
.auth-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ===========================
   Header
   =========================== */
.auth-header {
    background: var(--auth-primary);
    color: white;
    padding: 20px;
    text-align: center;
    margin-bottom: 0;
}

.auth-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.auth-intro {
    background: #fff;
    padding: 20px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: var(--auth-text);
    border-bottom: 1px solid var(--auth-border);
}

/* ===========================
   Response Messages
   =========================== */
.auth-message {
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 4px;
    display: none;
}

.auth-message.show {
    display: block;
}

.auth-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.auth-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.auth-message ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

/* ===========================
   Form Sections
   =========================== */
.auth-section {
    background: var(--auth-bg-white);
    border: 1px solid var(--auth-border);
    margin-bottom: 20px;
    padding: 20px;
}

.auth-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--auth-text);
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--auth-primary);
}

/* ===========================
   Form Fields
   =========================== */
.auth-form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.auth-field {
    padding: 0 10px;
    margin-bottom: 15px;
}

.auth-field.col-2 { width: 16.666%; }
.auth-field.col-3 { width: 25%; }
.auth-field.col-4 { width: 33.333%; }
.auth-field.col-6 { width: 50%; }
.auth-field.col-12 { width: 100%; }

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text);
    margin-bottom: 5px;
}

.auth-field label .required {
    color: var(--auth-error);
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="tel"],
.auth-field input[type="number"],
.auth-field select,
.auth-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(200, 50, 50, 0.1);
}

.auth-field input.is-invalid,
.auth-field select.is-invalid,
.auth-field textarea.is-invalid {
    border-color: var(--auth-error);
    background-color: #fff5f5;
}

.auth-field .field-error {
    color: var(--auth-error);
    font-size: 12px;
    margin-top: 5px;
}

.auth-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* File input styling */
.auth-field input[type="file"] {
    padding: 8px;
    background: var(--auth-bg-light);
}

.auth-field .file-preview {
    margin-top: 10px;
}

.auth-field .file-preview img {
    max-width: 150px;
    max-height: 100px;
    border: 1px solid var(--auth-border);
    border-radius: 4px;
}

/* ===========================
   Box Form (Company Invoice)
   =========================== */
.auth-box-form {
    border: 2px solid var(--auth-text);
    margin: 20px 0;
}

.auth-box-header {
    display: flex;
    border-bottom: 1px solid var(--auth-text);
}

.auth-box-statement {
    width: 50%;
    padding: 15px;
    border-right: 1px solid var(--auth-text);
}

.auth-box-invoice {
    width: 50%;
    padding: 15px;
}

.auth-box-statement h4 {
    font-size: 11px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.auth-box-statement p {
    font-size: 10px;
    margin: 5px 0;
    line-height: 1.4;
}

.auth-radio-option {
    display: flex;
    align-items: flex-start;
    margin: 8px 0;
    font-size: 10px;
}

.auth-radio-option input[type="radio"] {
    margin-right: 8px;
    margin-top: 2px;
}

/* Invoice header */
.auth-invoice-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.auth-company-logo {
    width: 70px;
    height: 70px;
    margin-right: 15px;
}

.auth-company-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.auth-invoice-title {
    flex: 1;
}

.auth-invoice-title h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-align: center;
}

.auth-invoice-field {
    display: flex;
    align-items: center;
    margin: 5px 0;
    font-size: 11px;
}

.auth-invoice-field span.label {
    min-width: 40px;
}

.auth-invoice-field span.value {
    border: 1px solid var(--auth-text);
    padding: 2px 8px;
    background: var(--auth-bg-light);
    min-width: 100px;
    min-height: 18px;
}

/* Customer info mirror */
.auth-customer-mirror {
    margin-top: 10px;
    font-size: 10px;
}

.auth-customer-mirror .row {
    display: flex;
    margin: 3px 0;
}

.auth-customer-mirror .field {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.auth-customer-mirror .field .label {
    margin-right: 5px;
}

.auth-customer-mirror .field .value {
    border: 1px solid var(--auth-text);
    padding: 2px 5px;
    background: var(--auth-bg-light);
    min-height: 16px;
    min-width: 80px;
}

/* Invoice/Estimate toggles */
.auth-doc-type {
    display: flex;
    margin-top: 10px;
}

.auth-doc-type label {
    flex: 1;
    text-align: center;
    padding: 8px;
    border: 1px solid var(--auth-text);
    font-weight: 700;
    font-size: 11px;
}

/* ===========================
   Parts Table
   =========================== */
.auth-parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.auth-parts-table th,
.auth-parts-table td {
    border: 1px solid var(--auth-text);
    padding: 4px 6px;
    text-align: center;
}

.auth-parts-table th {
    background: var(--auth-secondary);
    color: white;
    font-weight: 600;
    font-size: 9px;
}

.auth-parts-table th.labor-col {
    background: #444;
}

.auth-parts-table td {
    height: 20px;
    vertical-align: middle;
}

.auth-parts-table td.description {
    text-align: left;
    padding: 8px;
}

.auth-parts-table .complaint-cell {
    height: 60px;
    vertical-align: top;
    text-align: left;
    font-size: 9px;
    line-height: 1.3;
}

/* ===========================
   Vehicle Info Panel
   =========================== */
.auth-vehicle-panel {
    border: 1px solid var(--auth-text);
    padding: 10px;
    font-size: 10px;
}

.auth-vehicle-panel h4 {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-align: center;
    background: var(--auth-bg-light);
    padding: 5px;
}

.auth-vehicle-field {
    display: flex;
    margin: 5px 0;
}

.auth-vehicle-field .label {
    width: 60px;
    font-weight: 500;
}

.auth-vehicle-field .value {
    flex: 1;
    border: 1px solid var(--auth-text);
    padding: 2px 5px;
    background: var(--auth-bg-light);
    min-height: 16px;
}

/* Options section */
.auth-options-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--auth-border);
}

.auth-option-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 10px;
}

.auth-option-row label {
    display: flex;
    align-items: center;
}

.auth-option-row input[type="radio"],
.auth-option-row input[type="checkbox"] {
    margin-right: 5px;
}

/* ===========================
   Rates Table
   =========================== */
.auth-rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.auth-rates-table td {
    border: 1px solid var(--auth-text);
    padding: 4px 6px;
}

.auth-rates-table td:nth-child(even) {
    text-align: right;
}

/* ===========================
   Signature Section
   =========================== */
.auth-signature-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--auth-bg-light);
    border: 1px solid var(--auth-border);
    border-radius: 4px;
}

.auth-signature-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.auth-signature-field {
    flex: 1;
}

.auth-signature-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-signature-canvas-wrapper {
    border: 2px solid var(--auth-text);
    background: white;
    border-radius: 4px;
    cursor: crosshair;
}

.auth-signature-canvas {
    display: block;
    width: 100%;
    height: 80px;
}

.auth-signature-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.auth-signature-actions button {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--auth-border);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-signature-actions button:hover {
    background: var(--auth-bg-light);
}

.auth-signature-date {
    width: 150px;
}

.auth-signature-date .date-value {
    padding: 10px;
    border: 1px solid var(--auth-text);
    background: var(--auth-bg-light);
    text-align: center;
    font-weight: 500;
}

.auth-signature-display {
    margin-top: 10px;
    min-height: 60px;
}

.auth-signature-display img {
    max-height: 60px;
    max-width: 200px;
}

.auth-ip-info {
    font-size: 10px;
    color: var(--auth-text-light);
    margin-top: 5px;
}

/* ===========================
   Legal Text Sections
   =========================== */
.auth-legal-section {
    padding: 20px;
    background: white;
    border: 1px solid var(--auth-border);
    margin: 20px 0;
}

.auth-legal-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.auth-legal-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-text-light);
    margin: 0 0 15px 0;
}

.auth-legal-text {
    font-size: 11px;
    line-height: 1.5;
    color: var(--auth-text);
}

.auth-legal-text p {
    margin: 0 0 10px 0;
}

.auth-legal-text strong {
    font-weight: 600;
}

/* Consent checkbox */
.auth-consent-checkbox {
    display: flex;
    align-items: flex-start;
    margin: 20px 0;
    padding: 15px;
    background: var(--auth-bg-light);
    border-radius: 4px;
}

.auth-consent-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    width: 18px;
    height: 18px;
}

.auth-consent-checkbox label {
    font-size: 11px;
    line-height: 1.5;
    color: var(--auth-text);
}

/* ===========================
   Submit Button
   =========================== */
.auth-submit-section {
    text-align: center;
    padding: 30px 20px;
}

.auth-submit-btn {
    display: inline-block;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    background: var(--auth-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.auth-submit-btn:hover {
    background: var(--auth-primary-dark);
}

.auth-submit-btn:active {
    transform: scale(0.98);
}

.auth-submit-btn:disabled {
    background: var(--auth-text-light);
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.auth-loader {
    display: none;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid var(--auth-border);
    border-top-color: var(--auth-primary);
    border-radius: 50%;
    animation: auth-spin 1s linear infinite;
}

.auth-loader.show {
    display: block;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   Signature Modal
   =========================== */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.auth-modal.show {
    display: flex;
}

.auth-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.auth-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.auth-modal-close {
    font-size: 28px;
    cursor: pointer;
    color: var(--auth-text-light);
    line-height: 1;
}

.auth-modal-close:hover {
    color: var(--auth-text);
}

.auth-modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--auth-border);
    margin-bottom: 20px;
}

.auth-modal-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--auth-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-modal-tab.active {
    color: var(--auth-primary);
    border-bottom-color: var(--auth-primary);
}

.auth-modal-panel {
    display: none;
}

.auth-modal-panel.active {
    display: block;
}

.auth-modal-canvas {
    width: 100%;
    height: 150px;
    border: 2px solid var(--auth-text);
    border-radius: 4px;
    background: white;
    cursor: crosshair;
}

.auth-modal-type-input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    font-family: 'Brush Script MT', cursive;
    border: 2px solid var(--auth-text);
    border-radius: 4px;
    text-align: center;
}

.auth-modal-upload-input {
    width: 100%;
    padding: 15px;
    border: 2px dashed var(--auth-border);
    border-radius: 4px;
    text-align: center;
}

.auth-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.auth-modal-btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-modal-btn.primary {
    background: var(--auth-success);
    color: white;
}

.auth-modal-btn.primary:hover {
    background: #1d6d54;
}

.auth-modal-btn.secondary {
    background: var(--auth-border);
    color: var(--auth-text);
}

.auth-modal-btn.secondary:hover {
    background: #bbb;
}

/* ===========================
   Page Footer
   =========================== */
.auth-page-footer {
    text-align: center;
    font-size: 12px;
    color: var(--auth-text-light);
    padding: 10px;
    margin-top: 20px;
}

/* ===========================
   Responsive Styles
   =========================== */
@media (max-width: 992px) {
    .auth-field.col-2,
    .auth-field.col-3 {
        width: 50%;
    }

    .auth-box-header {
        flex-direction: column;
    }

    .auth-box-statement,
    .auth-box-invoice {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--auth-text);
    }

    .auth-box-invoice {
        border-bottom: none;
    }
}

@media (max-width: 768px) {
    .auth-form-container {
        padding: 10px;
    }

    .auth-header h1 {
        font-size: 18px;
    }

    .auth-field.col-2,
    .auth-field.col-3,
    .auth-field.col-4,
    .auth-field.col-6 {
        width: 100%;
    }

    .auth-signature-row {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-signature-date {
        width: 100%;
    }

    .auth-submit-btn {
        width: 100%;
        padding: 15px 20px;
    }

    .auth-parts-table {
        font-size: 8px;
    }

    .auth-parts-table th,
    .auth-parts-table td {
        padding: 2px 3px;
    }
}

/* ===========================
   Print Styles (for PDF preview)
   =========================== */
@media print {
    .auth-form-container {
        max-width: none;
        padding: 0;
    }

    .auth-submit-section,
    .auth-signature-actions,
    .auth-modal {
        display: none !important;
    }

    .auth-section {
        page-break-inside: avoid;
    }

    .auth-legal-section {
        page-break-before: always;
    }
}
