/* ==========================================================================
   CRYSTAL GLASSMORPHISM LIGHT THEME (BEx Data Tools)
   Scoped specifically to prevent conflicts with other modules
   ========================================================================== */

:root {
    --bex-primary: #256b9c;
    --bex-primary-hover: #1e557d;
    --bex-primary-light: rgba(37, 107, 156, 0.08);
    --bex-accent: #faa922;
    --bex-accent-hover: #e59513;
    --bex-success: #10b981;
    --bex-danger: #ef4444;
    --bex-bg-gradient: linear-gradient(135deg, #f8fafc 0%, #eef4f9 100%);
    
    /* Crystal Glass Specifics */
    --glass-surface: rgba(255, 255, 255, 0.78);
    --glass-surface-hover: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.85);
    --glass-border-subtle: rgba(226, 232, 240, 0.8);
    --glass-shadow: 0 10px 30px -5px rgba(37, 107, 156, 0.07), 0 4px 12px 0 rgba(0, 0, 0, 0.03);
    --glass-blur: blur(14px);
}

/* Container */
.crystal-portal-container {
    max-width: 1280px;
    margin: 1.5rem auto 3rem;
    padding: 0 1.5rem;
    animation: fadeInSlide 0.35s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Nav Bar & Buttons */
.portal-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.portal-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bex-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--bex-success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Header */
.crystal-header-block {
    margin-bottom: 1.75rem;
}
.crystal-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.4rem 0;
    letter-spacing: -0.02em;
}
.crystal-subtitle {
    color: #64748b;
    font-size: 0.98rem;
    margin: 0;
}

/* Crystal Cards */
.crystal-card {
    background: var(--glass-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    transition: all 0.25s ease;
}

.crystal-card:hover {
    box-shadow: 0 14px 35px -5px rgba(37, 107, 156, 0.12);
}

/* Form Elements */
.form-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
}

.glass-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.45rem;
}

.count-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bex-primary-light);
    color: var(--bex-primary);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(37, 107, 156, 0.2);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.glass-input, .glass-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: #0f172a;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.glass-input:focus, .glass-textarea:focus {
    background: #ffffff;
    border-color: var(--bex-primary);
    box-shadow: 0 0 0 3px rgba(37, 107, 156, 0.15);
}

.input-wrapper .input-addon {
    position: absolute;
    right: 12px;
    pointer-events: none;
    opacity: 0.6;
}

.glass-textarea {
    resize: vertical;
    min-height: 90px;
}

.mt-4 {
    margin-top: 1rem;
}

/* Buttons */
.form-actions-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: center;
}

.glass-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.4rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
}

.glass-btn-primary {
    background: linear-gradient(135deg, var(--bex-primary) 0%, #1a4f75 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 107, 156, 0.3);
}

.glass-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 107, 156, 0.4);
}

.glass-btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--glass-border-subtle);
    color: #334155;
}

.glass-btn-secondary:hover {
    background: #ffffff;
    color: var(--bex-primary);
    border-color: var(--bex-primary);
}

.glass-btn-ghost {
    background: transparent;
    color: #64748b;
}

.glass-btn-ghost:hover {
    color: var(--bex-danger);
    background: rgba(239, 68, 68, 0.06);
}

.glass-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.glass-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.glass-btn-accent {
    background: linear-gradient(135deg, var(--bex-accent) 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(250, 169, 34, 0.25);
}

.glass-btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(250, 169, 34, 0.35);
}

/* KPI Grid */
.kpi-glass-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--glass-shadow);
    border-left: 4px solid var(--bex-primary);
}

.kpi-card.delivered-kpi { border-left-color: var(--bex-success); }
.kpi-card.transit-kpi { border-left-color: var(--bex-accent); }
.kpi-card.exception-kpi { border-left-color: #8b5cf6; }

.kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.04em;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0.25rem 0;
}

.kpi-sub { font-size: 0.8rem; color: #94a3b8; }
.status-delivered-text { color: var(--bex-success); font-weight: 600; }
.status-transit-text { color: var(--bex-accent); font-weight: 600; }
.status-exception-text { color: #8b5cf6; font-weight: 600; }

/* Results Action Bar */
.results-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.glass-input-sm {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border-subtle);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    min-width: 260px;
}

.export-btn-group {
    display: flex;
    gap: 0.75rem;
}

/* Crystal Table */
.table-responsive-wrapper {
    overflow-x: auto;
    border-radius: 10px;
}

.crystal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.crystal-table th {
    background: rgba(241, 245, 249, 0.8);
    color: #334155;
    font-weight: 700;
    padding: 0.9rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.crystal-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    color: #1e293b;
    vertical-align: middle;
}

.crystal-table tbody tr {
    transition: background 0.15s ease;
}

.crystal-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.95);
}

.event-log-cell {
    max-width: 480px;
    line-height: 1.45;
    font-size: 0.84rem;
    color: #475569;
    word-break: break-word;
}

/* Badges */
.status-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}
.status-pill.delivered { background: #dcfce7; color: #15803d; }
.status-pill.in-transit { background: #fef3c7; color: #b45309; }
.status-pill.exception { background: #f3e8ff; color: #7e22ce; }

/* Spinner */
.crystal-loading-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--glass-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}
.crystal-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(37, 107, 156, 0.15);
    border-top-color: var(--bex-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar-glass {
    width: 260px;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    width: 30%;
    height: 100%;
    background: var(--bex-primary);
    animation: progressIndeterminate 1.5s infinite ease-in-out;
}
@keyframes progressIndeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

/* ==========================================================================
   AUTHENTIC SCREENSHOT-MATCHED DETAIL MODAL (CRYSTAL GLASS)
   ========================================================================== */

.glass-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1.5rem;
    animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.glass-modal-card {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    max-width: 900px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 2.25rem;
    position: relative;
    color: #0f172a;
    font-family: inherit;
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Modal Header Layout */
.modal-header-section {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1.5rem;
    margin-bottom: 1.75rem;
}

.modal-awb-sublabel {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.modal-awb-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 0.6rem 0;
}

.modal-status-hero {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
    font-weight: 800;
    color: #059669;
    margin-bottom: 0.4rem;
}

.modal-status-hero.in-transit {
    color: #d97706;
}

.modal-status-hero.exception {
    color: #7e22ce;
}

.modal-location-subtitle {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 0.75rem;
}

.modal-expected-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid #fed7aa;
    background: #fffbeb;
    color: #d97706;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1.25rem;
}

/* Route Line */
.modal-route-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    position: relative;
}

.modal-route-line {
    flex-grow: 1;
    height: 2px;
    background: #fcd34d;
    margin: 0 1rem;
    position: relative;
}

.modal-route-line::after {
    content: '▶';
    position: absolute;
    right: -4px;
    top: -6px;
    font-size: 10px;
    color: #fcd34d;
}

/* Metadata Grid Box */
.modal-metadata-box {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.75rem;
    background: #f8fafc;
}

.meta-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #e2e8f0;
}

.meta-grid-row:last-child {
    border-bottom: none;
}

.meta-grid-cell {
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 1px solid #e2e8f0;
}

.meta-grid-cell:last-child {
    border-right: none;
}

.meta-cell-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.03em;
}

.meta-cell-val {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
}

/* Forwarding Shipment Box */
.modal-forwarding-box {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-forwarding-label {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #d97706;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.modal-forwarding-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-forwarding-no {
    font-size: 1.75rem;
    font-weight: 800;
    color: #256b9c;
    text-decoration: underline;
    font-family: monospace;
}

.carrier-site-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.carrier-site-btn:hover {
    background: #f1f5f9;
    border-color: #256b9c;
    color: #256b9c;
}

/* Tracking History Section */
.history-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #d97706;
    letter-spacing: 0.05em;
    margin: 0;
}

.history-scans-badge {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.history-table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.history-table td {
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
}

.activity-bullet {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    margin-right: 8px;
}

.activity-bullet.delivered {
    background: #10b981;
}

.activity-name {
    font-weight: 700;
    color: #0f172a;
    display: inline;
}

.activity-sub-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-top: 4px;
    background: #f1f5f9;
    color: #64748b;
}

.awb-clickable-link {
    cursor: pointer;
    font-family: monospace;
    font-weight: 700;
    color: var(--bex-primary);
    text-decoration: underline;
    transition: color 0.15s;
}

.awb-clickable-link:hover {
    color: var(--bex-primary-hover);
}
