/**
 * TukTuk Rental Management System Stylesheet
 * Professional, responsive design with modern UI
 */

/* ========== Global Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --secondary-color: #6c757d;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --sidebar-width: 250px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
}

/* ========== Login Page ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #ffffff;
    padding: 40px 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.login-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
    padding: 48px 36px;
    text-align: center;
}

.login-logo img {
    max-width: 140px;
    margin-bottom: 20px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #64748b;
    font-size: 15px;
    margin-bottom: 28px;
}

.login-form {
    text-align: left;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.link-primary {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.link-primary:hover {
    color: var(--primary-dark);
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.3);
}

@media (max-width: 576px) {
    .login-card {
        padding: 36px 24px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 22px;
    }

    .login-subtitle {
        font-size: 14px;
    }
}

/* ========== Layout ========== */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-color);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    font-size: 20px;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 30px;
}

.sidebar-menu li.active a {
    background: var(--primary-color);
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-footer p {
    margin: 5px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    background: #f5f6fa;
    min-height: 100vh;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 32px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.content-header p {
    color: var(--text-muted);
    font-size: 16px;
}

/* ========== Cards ========== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 20px;
    color: var(--dark-color);
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* ========== Statistics Cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 48px;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-details h3 {
    font-size: 32px;
    margin: 0 0 5px 0;
}

.stat-details p {
    color: var(--text-muted);
    margin: 5px 0;
    font-size: 14px;
}

.stat-details small {
    color: var(--text-muted);
    font-size: 12px;
}

.stat-card-primary { border-left: 4px solid var(--primary-color); }
.stat-card-success { border-left: 4px solid var(--success-color); }
.stat-card-warning { border-left: 4px solid var(--warning-color); }
.stat-card-info { border-left: 4px solid var(--info-color); }

/* ========== Section Grid ========== */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* ========== TukTuk Lists ========== */
.tuktuk-list {
    display: grid;
    gap: 10px;
}

.tuktuk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.tuktuk-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tuktuk-item.available {
    background: #d4edda;
    border-color: #c3e6cb;
}

.tuktuk-number {
    font-weight: bold;
    color: var(--dark-color);
}

.tuktuk-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tuktuk-item.available .tuktuk-status {
    background: var(--success-color);
    color: white;
}

/* ========== Booked TukTuks ========== */
.booked-list {
    display: grid;
    gap: 10px;
}

.booked-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
}

.booked-item.normal {
    background: #fff3cd;
    border-color: var(--warning-color);
}

.booked-item.warning {
    background: #ffe5d0;
    border-color: #ff8800;
}

.booked-item.urgent {
    background: #f8d7da;
    border-color: var(--danger-color);
}

.booked-info strong {
    display: block;
    margin-bottom: 5px;
    color: var(--dark-color);
}

.booked-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.booked-return {
    text-align: right;
}

.booked-return p {
    margin: 0 0 5px 0;
    font-size: 13px;
}

.booked-return small {
    color: var(--text-muted);
    font-size: 12px;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
}

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

.table thead th {
    background: var(--light-color);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.actions-cell {
    white-space: nowrap;
}

/* ========== Forms ========== */
.form {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper .form-control {
    padding-right: 42px;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    transition: all 0.2s ease;
    outline: none;
    z-index: 10;
    width: 24px;
    height: 24px;
    margin: 0;
    line-height: 0;
    border-radius: 2px;
    flex-shrink: 0;
}

.password-toggle:hover {
    color: #212529;
    background: rgba(0, 0, 0, 0.03);
}

.password-toggle:active {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-50%) scale(0.95);
}

.password-toggle:focus {
    color: var(--primary-color);
    outline: none;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
    border-radius: 3px;
}

.password-toggle .eye-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.password-toggle svg {
    width: 100%;
    height: 100%;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.required {
    color: var(--danger-color);
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

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

.btn-block {
    display: block;
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-align: center;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: #333;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-info {
    background: var(--info-color);
    color: white;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-secondary {
    background: var(--secondary-color);
    color: white;
}

/* ========== Alerts ========== */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert ul {
    margin: 5px 0 0 20px;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info-color);
    color: #0c5460;
}

/* ========== TukTuk Selection ========== */
.tuktuk-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.tuktuk-group h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.tuktuk-option {
    display: block;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.tuktuk-option:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.tuktuk-option input[type="radio"] {
    margin-right: 10px;
}

.tuktuk-option input[type="radio"]:checked + .tuktuk-option-label {
    font-weight: bold;
}

.tuktuk-option.selected {
    border-color: var(--primary-color);
    background: #e7f1ff;
}

.addon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.addon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.addon-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 3px 12px rgba(0, 123, 255, 0.15);
}

.addon-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.addon-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
}

.addon-name {
    font-weight: 600;
    color: var(--dark-color);
}

.addon-price {
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 600;
}

/* ========== Booking Summary ========== */
.summary-grid {
    display: grid;
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--light-color);
    border-radius: 5px;
}

.summary-label {
    font-weight: 500;
    color: var(--dark-color);
}

.summary-value {
    font-weight: 600;
    color: var(--primary-color);
}

.summary-total {
    background: var(--primary-color);
    color: white;
}

.summary-total .summary-label,
.summary-total .summary-value {
    color: white;
    font-size: 18px;
}

/* ========== Invoice Styles ========== */
.invoice-page {
    background: #f5f6fa;
    padding: 20px;
}

.invoice-container {
    max-width: 900px;
    margin: 0 auto;
}

.invoice-content {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.company-info h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.company-info p {
    margin: 5px 0;
    color: var(--text-muted);
}

.invoice-title {
    text-align: right;
}

.invoice-title h2 {
    font-size: 32px;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.invoice-section {
    margin-bottom: 30px;
}

.invoice-section h3 {
    font-size: 18px;
    color: var(--dark-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

.info-table,
.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.info-table td:first-child {
    width: 150px;
}

.invoice-table th,
.invoice-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.invoice-table thead {
    background: var(--light-color);
}

.invoice-table tfoot {
    background: var(--light-color);
    font-weight: bold;
}

.text-right {
    text-align: right;
}

.terms-list {
    list-style: disc;
    margin-left: 20px;
}

.terms-list li {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.thank-you {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: var(--light-color);
    border-radius: 8px;
}

.signature-section {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
}

.signature-box {
    text-align: center;
}

.signature-box p:first-child {
    margin-bottom: 5px;
}

.invoice-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    body.invoice-page {
        background: #ffffff !important;
    }

    .invoice-container {
        max-width: none;
        width: 100%;
        margin: 0;
    }

    .invoice-content {
        padding: 10mm;
        box-shadow: none;
        border-radius: 0;
    }

    .invoice-actions {
        display: none !important;
    }
}

/* ========== Utility Classes ========== */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.loading-message {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.info-text {
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 20px;
    }

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

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

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

    .invoice-header {
        flex-direction: column;
        gap: 20px;
    }

    .invoice-title {
        text-align: left;
    }

    .signature-section {
        flex-direction: column;
        gap: 30px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .tuktuk-groups {
        grid-template-columns: 1fr;
    }
}

/* ========== Security Code Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
    font-size: 20px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 4px;
    font-weight: bold;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-error {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

.modal-error.show {
    display: block;
}
