@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Disabled card (e.g., stolen) */
.moto-card-item.disabled {
    pointer-events: none;
    opacity: 0.75;
    filter: grayscale(10%);
}

#app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 900px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #007BFF, #0056b3);
    color: white;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.main-content {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.back-btn {
    background: none; border: none; color: white;
    font-size: 1.6rem; cursor: pointer;
    width: 50px; /* Ensure alignment */
    text-align: left;
}

[dir='rtl'] .back-btn {
    text-align: right;
}

/* Language Switcher */
.lang-switcher button {
    background: none;
    border: 1px solid white;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    margin: 0 4px;
    transition: background-color 0.3s, color 0.3s;
}

.lang-switcher button.active {
    background-color: white;
    color: #007bff;
    font-weight: bold;
}

/* Home Page & General Cards */
.card-container {
    display: flex; gap: 16px; margin-bottom: 24px;
}
.card {
    background-color: #fff; border: 1px solid #e0e0e0;
    border-radius: 12px; padding: 20px; text-align: center;
    cursor: pointer; transition: all 0.3s ease-in-out; flex: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}
.card:hover { transform: translateY(-6px); box-shadow: 0 8px 16px rgba(0,0,0,0.12); }
.card i { font-size: 2.8rem; margin-bottom: 12px; color: #007bff; }
.card h2 { margin: 0; font-size: 1rem; font-weight: 600; color: #333; }

/* Motos List Page */
.actions-header {
    display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px;
}
.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.add-moto-btn {
    background-color: #007bff; color: white; border: none; padding: 12px 20px;
    border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: background-color 0.3s; text-align: center;
}
.add-moto-btn:hover { background-color: #0056b3; }
.add-moto-btn i { margin-right: 8px; }

/* New Info Cards Styling */
.info-cards-new.three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}


.info-card-new {
    flex: 1;
    border-radius: 12px;
    padding: 15px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.info-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.info-card-new.payment {
    background: linear-gradient(135deg, #28a745, #218838);
}

.info-card-new.withdrawal {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.info-card-new.completed {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.info-card-new.incomplete {
    background: linear-gradient(135deg, #ffc107, #e0a800);
}

.info-card-new.in-service {
    background: linear-gradient(135deg, #6f42c1, #5a32a3); /* Purple */
}

.info-card-new.in-maintenance {
    background: linear-gradient(135deg, #fd7e14, #d96d0d); /* Orange */
}

.info-card-new.stolen {
    background: linear-gradient(135deg, #343a40, #23272b); /* Dark Gray/Black */
}

.info-card-new .card-content h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: normal;
}

.info-card-new .card-content p {
    margin: 0;
    font-size: 1.4rem;
    font-weight: bold;
}

.info-card-new .card-icon i {
    font-size: 2rem;
    opacity: 0.7;
}

/* Single column variant for full-width cards */
.info-cards-new.one-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Four columns variant for summary cards */
.info-cards-new.four-col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 10px 0 20px 0;
}

/* Moto Grid View (for motos list page) */
.moto-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

/* Horizontal Scroller for home page favorites */
.home-moto-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 15px; /* For scrollbar visibility */
    gap: 15px;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}
.home-moto-grid::-webkit-scrollbar { /* Chrome, Safari, Opera */
    display: none;
}

.home-moto-grid .moto-card-item {
    flex: 0 0 140px; /* Do not grow, do not shrink, base width 140px */
    width: 140px;
}
.moto-card-item {
    background-color: #fff; border-radius: 10px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    pointer-events: auto; /* ensure clicks always pass through */
}
.moto-card-item:hover { transform: scale(1.05); box-shadow: 0 5px 15px rgba(0,0,0,0.15); }
.moto-card-item img {
    width: 100%; height: 100px; object-fit: cover;
}
.moto-card-item h3 {
    font-size: 0.9rem; margin: 0; padding: 10px; text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card footer with status badge */
.card-footer-row {
    display: flex;
    justify-content: center;
    padding: 8px 10px 12px 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.status-badge i { font-size: 0.85rem; }
.status-good { background: linear-gradient(135deg, #28a745, #1e7e34); }
.status-in_service { background: linear-gradient(135deg, #007bff, #0056b3); }
.status-in_maintenance { background: linear-gradient(135deg, #fd7e14, #d96d0d); }
 .status-stolen { background: linear-gradient(135deg, #dc3545, #a71d2a); }


/* Add/Edit Form */
#moto-form .form-group, #car-form .form-group { margin-bottom: 18px; }
#moto-form label, #car-form label { display: block; margin-bottom: 6px; font-weight: 600; color: #555; }
#moto-form input, #moto-form select, #car-form input, #car-form select {
    width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 8px;
    box-sizing: border-box; transition: border-color 0.3s, box-shadow 0.3s;
}
#moto-form input:focus, #moto-form select:focus, #car-form input:focus, #car-form select:focus, #weekly-payment-form input:focus, #weekly-payment-form select:focus {
    outline: none; border-color: #007bff; box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* Weekly Payment Form */
.days-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.day-checkbox {
    display: flex;
    align-items: center;
}

.day-checkbox input {
    margin-right: 8px;
}

[dir='rtl'] .day-checkbox input {
    margin-right: 0;
    margin-left: 8px;
}

/* Payment History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.history-header h3 {
    color: #0056b3;
    margin: 0;
}

.history-total {
    font-size: 1.2rem;
    font-weight: bold;
    color: #28a745;
    background-color: #e9f7ef;
    padding: 5px 10px;
    border-radius: 8px;
}

.payment-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-row {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-info .history-date {
    font-weight: bold;
    color: #333;
}

.history-info .history-amount {
    margin-left: 15px;
    color: #28a745;
    font-weight: bold;
}

[dir='rtl'] .history-info .history-amount {
    margin-left: 0;
    margin-right: 15px;
}

.history-days {
    display: flex;
    gap: 5px;
}

.day-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.day-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

.day-name {
    font-size: 0.7rem;
    color: #555;
}

.day-status.paid {
    background-color: #28a745; /* Green for paid */
}

.day-status.unpaid {
    background-color: #dc3545; /* Red for unpaid */
}
.file-input-stack { margin-bottom: 8px; }
.submit-btn {
    width: 100%; padding: 14px; background-color: #28a745; color: white;
    border: none; border-radius: 8px; font-size: 1.1rem; font-weight: bold;
    cursor: pointer; transition: background-color 0.3s; margin-top: 10px;
}
.submit-btn:hover { background-color: #218838; }

/* Details Page */
.details-page h2 { text-align: center; color: #0056b3; margin-top: 15px; }

.details-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.details-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: opacity 0.3s;
}

.details-actions button:hover { opacity: 0.8; }

.btn-edit {
    background-color: #ffc107; /* Yellow */
}

.btn-delete {
    background-color: #dc3545; /* Red */
}

/* Edit Form */
.image-preview {
    max-width: 100px;
    max-height: 100px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
}
.details-slider {
    width: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    border-radius: 10px; margin-bottom: 20px;
}
.details-slider .slide { scroll-snap-align: start; flex-shrink: 0; width: 100%; }
.details-slider img { width: 100%; height: 250px; object-fit: cover; }

.details-grid {
    display: grid; gap: 12px;
}

.details-grid p { margin: 0; padding: 10px; background-color: #f8f9fa; border-radius: 8px; display: flex; align-items: center; }
.details-grid p i { margin-right: 10px; color: #007bff; width: 20px; text-align: center; }
[dir='rtl'] .details-grid p i { margin-right: 0; margin-left: 10px; }

/* Reports Section */
.reports-section {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.reports-section h3 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 15px;
}

.report-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 10px;
}

.report-buttons button {
    flex: 1;
    padding: 12px;
    background-color: #17a2b8; /* Info Blue */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.report-buttons button:hover, .report-buttons button.active {
    background-color: #138496;
    box-shadow: 0 0 10px rgba(19, 132, 150, 0.5);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.report-table th, .report-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.report-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.report-table tfoot {
    background-color: #e9f7ef;
    color: #155724;
}

/* Withdrawals List */
.withdrawals-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.withdrawal-card {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.withdrawal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.driver-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

[dir='rtl'] .driver-avatar {
    margin-right: 0;
    margin-left: 15px;
}

.withdrawal-info {
    flex-grow: 1;
}

.withdrawal-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: #333;
}

.withdrawal-info p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 0.9rem;
}

.withdrawal-info .withdrawal-date {
    font-size: 0.8rem;
    color: #888;
}

.withdrawal-info i {
    margin-right: 5px;
    color: #007bff;
}

[dir='rtl'] .withdrawal-info i {
    margin-right: 0;
    margin-left: 5px;
}

.withdrawal-amount {
    font-size: 1.2rem;
    font-weight: bold;
    color: #dc3545; /* Red for withdrawal */
}

.download-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.download-buttons button {
    padding: 8px 12px;
    background-color: #6c757d; /* Gray */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.download-buttons button:hover {
    background-color: #5a6268;
}

/* Inline actions for history items */
.history-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}
[dir='rtl'] .history-actions { margin-left: 0; margin-right: 10px; }

.withdrawals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.total-withdrawals h3 {
    margin: 0;
    font-size: 1rem;
    color: #6c757d;
}

.total-withdrawals p {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #dc3545;
}

/* Weekly Payment Page Enhancements */
.payment-form-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.section-divider {
    border: 0;
    height: 1px;
    background-color: #e9ecef;
    margin: 30px 0;
}

.payment-history-section h2 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 20px;
}

.history-total-banner {
    background: linear-gradient(135deg, #007BFF, #0056b3);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.history-total-banner h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: normal;
    opacity: 0.9;
}

.history-total-banner p {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
}

.payment-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-record-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.09);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden; /* To keep border-radius on children */
}

.payment-record-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.payment-record-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

.payment-record-card .driver-name {
    font-weight: bold;
    color: #343a40;
    font-size: 1.05rem;
}

.payment-record-card .payment-amount {
    font-weight: bold;
    font-size: 1.1rem;
    color: #28a745; /* Green for payment */
}

.payment-record-card .card-body {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

.payment-record-card .card-body span {
    display: flex;
    align-items: center;
}
.payment-record-card .card-body i {
    color: #007bff;
    margin-right: 8px;
    width: 16px; /* Align icons */
    text-align: center;
}

/* Summary table for car reports */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.summary-table th, .summary-table td {
    border: 1px solid #e3e6ea;
    padding: 10px;
    font-size: 0.9rem;
}
.summary-table th {
    background-color: #f8f9fa;
    color: #495057;
}
.summary-table .bar {
    height: 6px;
    background: linear-gradient(90deg, #17a2b8, #28a745);
    border-radius: 4px;
    margin-top: 6px;
}

/* ===== Login Page Container Overrides ===== */
body[data-current-page="login"] {
    align-items: flex-start; /* top align the main app container */
}
body[data-current-page="login"] #app-container {
    max-width: 980px; /* allow wider layout for two columns */
    width: 100%;
    height: auto;         /* let height grow with content */
    max-height: none;     /* remove cap */
    overflow: visible;    /* do not clip login content */
    background: transparent; /* let login box styling show */
    box-shadow: none;     /* remove inner card look on login */
}
@media (max-width: 1024px) {
  body[data-current-page="login"] #app-container {
    max-width: 100%;
  }
}