﻿/* ============================
   TRANSITPAY - UI COMPONENTS
   ============================ */

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1002;
    /* Above overlay */
    transition: var(--transition-base);
}


/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1001;

    display: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.active {
        left: 0;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }
}



.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon-sm {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
}

.menu-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--primary-300);
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-500);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 1rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-phone {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-500);
    color: var(--danger-400);
}

/* Mobile Topbar */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1000;
}


@media (max-width: 1024px) {
    .mobile-topbar {
        display: flex;
    }
}


.hamburger {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 6px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition-fast);
}

.mobile-title {
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
}

/* ============================
   MAIN CONTENT
   ============================ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: var(--transition-base);
}

@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 6rem 1.25rem 2rem;
    }
}


.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

@media (max-width: 600px) {
    .section-header h2 {
        font-size: 1.5rem;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}


.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.select-input {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    outline: none;
    transition: var(--transition-fast);
}

.select-input:focus {
    border-color: var(--primary-500);
}

/* ============================
   STATS CARDS
   ============================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}


.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

@media (max-width: 600px) {
    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}


.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card-primary::before {
    background: linear-gradient(90deg, var(--primary-500), #8b5cf6);
}

.stat-card-success::before {
    background: linear-gradient(90deg, var(--success-500), #34d399);
}

.stat-card-warning::before {
    background: linear-gradient(90deg, var(--warning-500), #fbbf24);
}

.stat-card-info::before {
    background: linear-gradient(90deg, var(--info-500), #38bdf8);
}

.stat-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-400);
}

.stat-card-success .stat-icon {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-400);
}

.stat-card-warning .stat-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
}

.stat-card-info .stat-icon {
    background: rgba(14, 165, 233, 0.12);
    color: var(--info-400);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0.15rem 0;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    width: fit-content;
}

.stat-change.positive {
    color: var(--success-400);
    background: rgba(34, 197, 94, 0.1);
}

.stat-change.negative {
    color: var(--danger-400);
    background: rgba(239, 68, 68, 0.1);
}

/* ============================
   CHARTS
   ============================ */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1100px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}


.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.chart-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.monthly-dot {
    background: var(--primary-500);
}

.trip-dot {
    background: #06b6d4;
}

.chart-body {
    height: 250px;
    position: relative;
}

.chart-body-donut {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
}

.donut-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.donut-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================
   TABLES
   ============================ */
.recent-card,
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

.data-table .badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-monthly {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-400);
}

.badge-trip {
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
}

.badge-paid {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-400);
}

.empty-state-mini {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* ============================
   PAYMENT TYPE SELECTOR
   ============================ */
.payment-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .payment-type-selector {
        grid-template-columns: 1fr;
    }
}


.type-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.type-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent);
    opacity: 0;
    transition: var(--transition-fast);
}

.type-btn:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.type-btn.active {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
}

.type-btn.active::before {
    opacity: 1;
}

.type-icon {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
}

.type-btn.active .type-icon {
    color: var(--primary-400);
}

.type-label {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.type-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================
   RECEIPT FORM
   ============================ */
.receipt-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

@media (max-width: 600px) {
    .receipt-form-card {
        padding: 1.25rem;
    }
}


.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}


.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-accent);
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.conditional-fields {
    display: none;
}

.conditional-fields.active {
    display: block;
}

/* Trip Entries */
.trip-entry {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: var(--transition-fast);
}

.trip-entry:hover {
    border-color: var(--border-color-hover);
}

.trip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.trip-number {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-400);
}

.btn-remove-trip {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-remove-trip:hover {
    background: rgba(239, 68, 68, 0.1);
}

.trip-grid {
    grid-template-columns: repeat(4, 1fr);
}

.btn-add-trip {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    border-style: dashed;
    border-width: 2px;
    margin-bottom: 1rem;
}

.trip-total-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--primary-500);
    border-radius: var(--radius-md);
    font-weight: 700;
}

.trip-total-value {
    font-size: 1.25rem;
    font-family: var(--font-mono);
    color: var(--primary-300);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================
   PAYMENT STATUS RADIO GROUP
   ============================ */
.payment-status-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.status-radio-label {
    cursor: pointer;
}

.status-radio-label input[type="radio"] {
    display: none;
}

.status-radio-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    border: 2px solid transparent;
    transition: var(--transition-fast);
    user-select: none;
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* General checked state (for Visa/Aremex/Cash etc without specific class) */
.status-radio-label input[type="radio"]:checked+.status-radio-btn {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-500);
    color: var(--primary-300);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.status-radio-label input[type="radio"]:checked+.status-radio-btn.status-paid {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #4ade80;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.status-radio-label input[type="radio"]:checked+.status-radio-btn.status-unpaid {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #f87171;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.status-radio-label input[type="radio"]:checked+.status-radio-btn.status-pending {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    color: #fcd34d;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.status-radio-btn.status-paid:hover {
    border-color: #22c55e;
    color: #4ade80;
}

.status-radio-btn.status-unpaid:hover {
    border-color: #ef4444;
    color: #f87171;
}

.status-radio-btn.status-pending:hover {
    border-color: #f59e0b;
    color: #fcd34d;
}

/* ============================
   RECEIPTS GRID
   ============================ */
.receipts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.receipt-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.receipt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.receipt-card.monthly::before {
    background: linear-gradient(90deg, var(--primary-500), #8b5cf6);
}

.receipt-card.trip::before {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.receipt-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    border-color: var(--border-color-hover);
}

.receipt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.receipt-card-number {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-accent);
}

.receipt-card-client {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.receipt-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.receipt-card-amount {
    font-size: 1.35rem;
    font-weight: 800;
    font-family: var(--font-mono);
    margin-top: 1rem;
}

.receipt-card.monthly .receipt-card-amount {
    color: var(--primary-400);
}

.receipt-card.trip .receipt-card-amount {
    color: #22d3ee;
}

.receipt-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
}

/* ============================
   RECEIPT PREVIEW (PRINT)

/* ============================
   TOAST NOTIFICATIONS
   ============================ */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.success {
    border-left: 4px solid var(--success-500);
}

.toast.error {
    border-left: 4px solid var(--danger-500);
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid var(--info-500);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ============================
   PRINT STYLES
   ============================ */
@media print {
    body * {
        visibility: hidden;
    }

    .receipt-document,
    .receipt-document *,
    .report-print-area,
    .report-print-area * {
        visibility: visible !important;
    }

    .receipt-document,
    .report-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: #1a1a2e !important;
    }

    .no-print {
        display: none !important;
    }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 80px 1rem 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .payment-type-selector {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .trip-grid {
        grid-template-columns: 1fr 1fr;
    }

    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .receipts-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
    }

    .receipt-body {
        padding: 1.5rem;
    }

    .receipt-company-row {
        flex-direction: column;
        gap: 1rem;
    }

    .receipt-label-box {
        text-align: left;
    }

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

@media (max-width: 480px) {
    .trip-grid {
        grid-template-columns: 1fr;
    }

    .receipt-total-row {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* ============================
   CLIENT SELECT BAR
   ============================ */
.client-select-bar {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
    border: 1px dashed var(--primary-500);
    border-radius: var(--radius-md);
}

/* ============================
   TABLE ACTION BUTTONS
   ============================ */
.action-btn-group {
    display: flex;
    gap: 0.4rem;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-action:hover {
    border-color: var(--primary-500);
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.08);
}

.btn-action.btn-action-danger:hover {
    border-color: var(--danger-500);
    color: var(--danger-400);
    background: rgba(239, 68, 68, 0.08);
}

.btn-action.btn-action-edit:hover {
    border-color: var(--primary-500);
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.12);
}

/* ============================
   STATUS BADGES
   ============================ */
.badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-400);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
}

.badge-admin {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-400);
}

.badge-operator {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
}

.badge-viewer {
    background: rgba(14, 165, 233, 0.12);
    color: var(--info-400);
}

/* ============================
   MENU SECTION DIVIDER
   ============================ */
.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1rem;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .client-select-bar {
        flex-direction: column;
    }
}

/* ============================
   FILE UPLOAD AREA
   ============================ */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    overflow: hidden;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.04);
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    gap: 0.5rem;
}

.file-upload-content p {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-upload-content span {
    font-size: 0.75rem;
}

.file-preview {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(99, 102, 241, 0.05);
}

.file-preview .file-info {
    flex: 1;
}

.file-preview .file-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-all;
}

.file-preview .file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-preview .file-remove {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.file-preview .file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.file-icon.pdf {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
}

.file-icon.img {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success-400);
}

/* Petrol badge */
.badge-petrol {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
}


/* ==================== MENU DIVIDER ==================== */
.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1rem;
}

/* ==================== TAG LIST (Locations / Car Plates) ==================== */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition-fast);
    animation: fadeInScale 0.2s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-item .tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: none;
    color: var(--danger-400);
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 700;
    transition: var(--transition-fast);
    line-height: 1;
}

.tag-item .tag-remove:hover {
    background: rgba(239, 68, 68, 0.3);
    color: var(--danger-500);
}

/* ============================
   TENANT MANAGEMENT
   ============================ */

/* Info Banner */
.tenant-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    color: var(--primary-400);
}

.tenant-info-banner strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.tenant-info-banner p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

/* Tenant Cards Grid */
.tenant-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

/* Individual Tenant Card */
.tenant-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-fast);
    position: relative;
}

.tenant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), #8b5cf6, #06b6d4);
}

.tenant-card.suspended::before {
    background: linear-gradient(90deg, var(--danger-500), var(--warning-500));
    opacity: 0.6;
}

.tenant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: var(--border-color-hover);
}

.tenant-card.suspended {
    opacity: 0.7;
}

.tenant-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
}

.tenant-code-chip {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.06em;
}

.tenant-card-body {
    padding: 1rem 1.25rem;
}

.tenant-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tenant-card-phone {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.tenant-card-notes {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.04);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--primary-500);
}

/* Tenant Stats Row */
.tenant-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.tenant-stat {
    padding: 0.75rem;
    text-align: center;
}

.tenant-stat+.tenant-stat {
    border-left: 1px solid var(--border-color);
}

.tenant-stat-value {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.tenant-stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

/* Tenant Card Footer (Actions) */
.tenant-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
}

.tenant-card-meta {
    padding: 0 1.25rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Return-to-host banner */
.return-to-host-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(234, 88, 12, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    color: var(--warning-400);
    font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
}

.return-to-host-banner strong {
    color: var(--text-primary);
}

/* Tenant code badge in sidebar */
.tenant-code-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--primary-400);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.08em;
    margin-top: 0.5rem;
}

/* Empty state */
.tenant-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.tenant-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1rem 0 0.5rem;
}

.tenant-empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .tenant-cards-grid {
        grid-template-columns: 1fr;
    }

    .return-to-host-banner {
        flex-wrap: wrap;
    }
}

/* ============================
   PERMISSIONS PAGE
   ============================ */

.perm-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.perm-role-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    transition: var(--transition-fast);
}

.perm-role-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-1px);
}

.perm-role-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.perm-role-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.perm-locked-tag {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.perm-role-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.perm-role-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.perm-role-stats span {
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.perm-matrix-wrapper {
    overflow-x: auto;
}

.perm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.perm-table thead tr {
    border-bottom: 2px solid var(--border-color);
}

.perm-table th {
    padding: 1rem 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-surface);
}

.perm-module-col {
    text-align: left !important;
    width: 180px;
    background: var(--bg-surface);
    position: sticky;
    left: 0;
    z-index: 2;
}

.perm-role-col {
    min-width: 160px;
}

.perm-table tbody tr {
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    transition: var(--transition-fast);
}

.perm-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.perm-module-cell {
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-surface);
    position: sticky;
    left: 0;
    z-index: 1;
    border-right: 1px solid var(--border-color);
}

.perm-module-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.perm-module-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.perm-actions-cell {
    padding: 0.6rem 1rem;
    text-align: center;
    vertical-align: middle;
}

.perm-toggles {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
    align-items: center;
}

.perm-toggle-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    user-select: none;
}

.perm-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-500);
    cursor: pointer;
    border-radius: 4px;
}

.perm-toggle-text {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.perm-toggle-label:has(input:checked) .perm-toggle-text {
    color: var(--primary-400);
}

.perm-toggle-label.perm-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.perm-toggle-label.perm-locked input {
    cursor: not-allowed;
}

.perm-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    flex-wrap: wrap;
    gap: 1rem;
}

.perm-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.perm-legend-item {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.perm-readonly-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.user-perm-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
}

.badge-admin {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

.badge-operator {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
}

.badge-viewer {
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
}

.badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

@media (max-width: 900px) {
    .perm-role-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .perm-role-grid {
        grid-template-columns: 1fr;
    }

    .perm-table th,
    .perm-table td {
        padding: 0.5rem 0.6rem;
    }

    .perm-role-col {
        min-width: 100px;
    }
}

/* ============================
   MONTHLY BILLING
   ============================ */
.unpaid-client-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.unpaid-client-row:last-child {
    border-bottom: none;
}

.unpaid-client-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.unpaid-client-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-xs {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.25);
    transform: translateY(-1px);
}