/* Customer Billing Lookup Portal - Styles
 * No jQuery dependency, WCAG-friendly, responsive
 */

.cbl-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.cbl-container *,
.cbl-container *::before,
.cbl-container *::after {
    box-sizing: border-box;
}

.cbl-form-wrapper {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.cbl-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #222;
}

.cbl-description {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 25px 0;
}

.cbl-form .cbl-field {
    margin-bottom: 20px;
}

.cbl-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #444;
    font-size: 0.9rem;
}

.cbl-required {
    color: #dc3545;
}

.cbl-input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.cbl-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.cbl-input.cbl-input-error {
    border-color: #dc3545;
}

.cbl-input.cbl-input-error:focus {
    box-shadow: 0 0 0 1px #dc3545;
}

.cbl-error {
    display: block;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 4px;
    min-height: 1.2em;
}

.cbl-captcha {
    margin-bottom: 20px;
}

.cbl-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.cbl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    min-height: 44px;
}

.cbl-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.cbl-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cbl-btn-primary {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.cbl-btn-primary:hover:not(:disabled) {
    background: #135e96;
    border-color: #135e96;
}

.cbl-btn-secondary {
    background: #f0f0f0;
    color: #444;
    border-color: #ddd;
}

.cbl-btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #ccc;
}

.cbl-loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 1rem;
}

.cbl-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: cbl-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes cbl-spin {
    to { transform: rotate(360deg); }
}

.cbl-result-wrapper {
    margin-top: 0;
}

.cbl-result-inner {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cbl-status-bar {
    font-size: 1rem;
}

.cbl-section {
    margin-bottom: 25px;
}

.cbl-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
    color: #222;
}

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

.cbl-table th,
.cbl-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.cbl-table th {
    font-weight: 600;
    color: #555;
    width: 40%;
    background: #fafafa;
}

.cbl-table td {
    color: #333;
}

.cbl-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cbl-table-invoices th {
    background: #f5f5f5;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #555;
}

.cbl-table-invoices td {
    font-size: 0.88rem;
}

.cbl-notice {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.88rem;
    margin-top: 20px;
}

.cbl-notice-info {
    background: #f0f6fc;
    border: 1px solid #c5d9ed;
    color: #1d2327;
}

.cbl-notice-info p {
    margin: 0;
}

.cbl-result-message {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cbl-result-message .cbl-message-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.cbl-result-message p {
    font-size: 1rem;
    color: #666;
    margin: 0;
}

/* Dark mode via system preference */
@media (prefers-color-scheme: dark) {
    .cbl-container:not(.cbl-dark-mode) .cbl-form-wrapper,
    .cbl-container:not(.cbl-dark-mode) .cbl-result-inner {
        background-color: #1e1e1e;
        color: #e0e0e0;
        border-color: #444;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-title {
        color: #e0e0e0;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-description {
        color: #aaa;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-label {
        color: #ccc;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-input {
        background-color: #2d2d2d;
        color: #e0e0e0;
        border-color: #555;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-input:focus {
        border-color: #4a9eff;
        box-shadow: 0 0 0 1px #4a9eff;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-table th {
        background-color: #333;
        color: #ccc;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-table td {
        border-color: #444;
        color: #e0e0e0;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-section-title {
        border-bottom-color: #333;
        color: #e0e0e0;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-notice-info {
        background: #1a2a3a;
        border-color: #2a4a6a;
        color: #c0d0e0;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-result-message {
        background: #1e1e1e;
        border-color: #444;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-result-message p {
        color: #aaa;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-status-bar {
        background: rgba(255, 255, 255, 0.05);
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-btn-secondary {
        background: #333;
        color: #ccc;
        border-color: #555;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-btn-secondary:hover {
        background: #444;
    }

    .cbl-container:not(.cbl-dark-mode) .cbl-table-invoices th {
        background: #2a2a2a;
        color: #aaa;
    }
}

/* Mobile responsive */
@media (max-width: 600px) {
    .cbl-container {
        padding: 10px 0;
    }

    .cbl-form-wrapper,
    .cbl-result-inner {
        padding: 20px 15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .cbl-title {
        font-size: 1.25rem;
    }

    .cbl-actions {
        flex-direction: column;
    }

    .cbl-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .cbl-table th {
        width: 35%;
        font-size: 0.82rem;
        padding: 8px 10px;
    }

    .cbl-table td {
        font-size: 0.82rem;
        padding: 8px 10px;
    }

    .cbl-table-invoices th,
    .cbl-table-invoices td {
        font-size: 0.8rem;
        padding: 6px 8px;
        white-space: nowrap;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .cbl-container {
        max-width: 100%;
        padding: 15px;
    }
}

/* Accessibility: Focus visible styles */
.cbl-input:focus-visible,
.cbl-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Screen reader only */
.cbl-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cbl-footer {
    margin-top: 20px;
    padding: 15px 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #555;
}

.cbl-footer p:last-child {
    margin-bottom: 0;
}

@media (prefers-color-scheme: dark) {
    .cbl-container:not(.cbl-dark-mode) .cbl-footer {
        background: #1e1e1e;
        border-color: #444;
        color: #aaa;
    }
}

/* Print styles */
@media print {
    .cbl-btn,
    .cbl-actions,
    .cbl-loading {
        display: none !important;
    }

    .cbl-container {
        max-width: 100%;
        padding: 0;
    }

    .cbl-form-wrapper,
    .cbl-result-inner {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
