/* AvioDirect Customer Portal */

.avio-portal {
    max-width: 960px;
    font-family: inherit;
    font-size: inherit;
}

/* Card */
.avio-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    max-width: 480px;
    margin: 24px 0;
}

.avio-card h2 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    color: #002147;
}

.avio-subtitle {
    color: #6b7280;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Form */
.avio-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.avio-input-row {
    display: flex;
    gap: 8px;
}

.avio-input-row input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.avio-input-row input[type="text"]:focus {
    border-color: #002147;
    box-shadow: 0 0 0 3px rgba(0, 33, 71, 0.1);
}

/* Buttons */
.avio-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

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

.avio-btn-primary {
    background: #002147;
    color: #fff;
}

.avio-btn-primary:hover:not(:disabled) {
    background: #D4A200;
    color: #fff;
}

.avio-btn-outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

.avio-btn-outline:hover:not(:disabled) {
    background: #f9fafb;
}

.avio-btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

/* Messages */
.avio-msg {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.avio-msg.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 3px solid #10b981;
}

.avio-msg.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

.avio-help-text {
    margin-top: 20px;
    font-size: 0.85rem;
    color: #9ca3af;
}

.avio-help-text a {
    color: #002147;
}

/* Orders header */
.avio-orders-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.avio-orders-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #002147;
    font-weight: 700;
}

.avio-company-badge {
    background: #002147;
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* Notices */
.avio-notice {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}

.avio-notice-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
}

.avio-notice-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

/* Loading */
.avio-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    padding: 20px 0;
}

.avio-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #002147;
    border-radius: 50%;
    animation: avio-spin 0.7s linear infinite;
    display: inline-block;
}

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

/* Table */
.avio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: inherit;
}

.avio-table th {
    background: #f8fafc;
    padding: 11px 14px;
    text-align: left;
    font-weight: 700;
    color: #002147;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.avio-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: #374151;
    vertical-align: middle;
}

.avio-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.avio-table tbody tr:hover td {
    background: #f0f4f8;
}

.avio-table td.avio-actions-cell {
    cursor: default;
}

/* View button */
.avio-view-btn {
    background: #002147;
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.avio-view-btn:hover {
    background: #D4A200;
}

/* Status badges */
.avio-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-delivered    { background: #d1fae5; color: #065f46; }
.status-cancelled    { background: #fee2e2; color: #991b1b; }
.status-await-pay    { background: #fef3c7; color: #92400e; }
.status-credit       { background: #ede9fe; color: #5b21b6; }
.status-pending      { background: #dbeafe; color: #1e40af; }
.status-issue        { background: #fee2e2; color: #7f1d1d; }
.status-processing   { background: #f0f9ff; color: #0369a1; }
.status-unknown      { background: #f3f4f6; color: #6b7280; }

/* Condition badges (inside modal line items) */
.avio-condition {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: #f3f4f6;
    color: #374151;
}
.avio-cond-ns { background: #d1fae5; color: #065f46; }   /* New Surplus */
.avio-cond-ne { background: #dbeafe; color: #1e40af; }   /* New */
.avio-cond-oh { background: #ede9fe; color: #5b21b6; }   /* Overhauled */
.avio-cond-ar { background: #fef3c7; color: #92400e; }   /* As Removed */

/* Empty state */
.avio-empty {
    text-align: center;
    color: #9ca3af;
    padding: 32px 20px;
    font-style: italic;
}

/* Admin */
.avio-admin-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.avio-admin-card h2 {
    margin: 0 0 16px;
}

.avio-count {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: normal;
}

.avio-ok    { color: #065f46; font-weight: 600; }
.avio-error { color: #991b1b; font-weight: 600; }

.avio-admin-table td,
.avio-admin-table th {
    padding: 8px 12px;
}

/* ── Modal overlay ──────────────────────────────────────────── */

.avio-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.avio-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avio-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 33, 71, 0.6);
    cursor: pointer;
}

.avio-modal-container {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 10px;
    width: 92%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: avio-modal-in 0.18s ease-out;
}

@keyframes avio-modal-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

.avio-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #002147;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
    gap: 12px;
}

.avio-modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.avio-modal-po-num {
    margin: 0;
    font-size: 1.15rem;
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}

.avio-modal-date {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.avio-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px 9px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.avio-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.avio-modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Summary grid */
.avio-modal-summary {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8fafc;
}

.avio-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.avio-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.avio-summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    font-weight: 700;
}

.avio-summary-value {
    font-size: 0.95rem;
    color: #1a1a2e;
    font-weight: 500;
}

.avio-total-value {
    color: #002147;
    font-weight: 800;
    font-size: 1.1rem;
}

/* Modal sections */
.avio-modal-section {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.avio-modal-section:last-child {
    border-bottom: none;
}

.avio-modal-section-title {
    margin: 0 0 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    font-weight: 700;
}

.avio-modal-table-wrap {
    overflow-x: auto;
}

.avio-line-items-table {
    min-width: 500px;
}

.avio-line-items-table th {
    background: #f1f5f9;
    font-size: 0.72rem;
    padding: 9px 12px;
}

.avio-line-items-table td {
    font-size: 0.88rem;
    padding: 10px 12px;
}

/* Shipping section */
.avio-shipping-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.avio-address {
    font-family: inherit;
    font-size: 0.9rem;
    color: #374151;
    margin: 6px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.avio-comments-text {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

body.avio-modal-open {
    overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .avio-input-row {
        flex-direction: column;
    }
    /* Hide Part(s) and Total columns on small screens */
    .avio-table th:nth-child(3),
    .avio-table td:nth-child(3),
    .avio-table th:nth-child(5),
    .avio-table td:nth-child(5) {
        display: none;
    }
    /* Modal slides up from bottom on mobile */
    .avio-modal.is-open {
        align-items: flex-end;
    }
    .avio-modal-container {
        width: 100%;
        max-height: 92dvh;
        border-radius: 14px 14px 0 0;
    }
    .avio-shipping-grid {
        grid-template-columns: 1fr;
    }
    .avio-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}
