/* ----- Theme Colors ----- */
:root {
    --primary-color: #007bff;        /* Main blue */
    --secondary-color: #0056b3;      /* Hover blue */
    --bg-color: #f8f9fa;             /* Page background */
    --text-color: #212529;           /* Main text */
    --header-bg: #343a40;            /* Header background */
    --header-text: #ffffff;          /* Header text */
    --highlight-bg: #fff3cd;         /* Highlight box background */
}

/* ----- Global Reset ----- */
body {
    font-family: Arial, sans-serif;
    background: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    max-width: 100%;
    overflow-x: hidden;
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    padding: 10px 20px;
    color: var(--header-text);
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

header button {
    padding: 8px 15px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

header button:hover {
    background: var(--secondary-color);
}

#search {
    display: block;
    margin: 15px auto;
    padding: 8px;
    width: 300px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
}

/* Table Styling */
table {
    width: 98%;
    margin: auto;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: var(--header-bg);
    color: var(--header-text);
}

.odometer-container {
    text-align: center;
    padding: 10px;
    background: var(--highlight-bg);
    font-size: 14px;
    border-bottom: 1px solid #ddd;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 400px;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover, .close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

label {
    display: block;
    margin: 8px 0;
}

input {
    width: 100%;
    padding: 6px;
    margin-top: 3px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
}

button[type=submit] {
    background: var(--primary-color);
    color: white;
    padding: 8px;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 4px;
}

button[type=submit]:hover {
    background: var(--secondary-color);
}

/* ----- Responsive Design ----- */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    #search {
        width: 90%;
    }
    table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    input, button, select {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }
    h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    table {
        font-size: 13px;
    }
    h1 {
        font-size: 1.2rem;
    }
}

/* ----- Mobile Card View for Table ----- */
@media (max-width: 768px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        display: none; /* Hide header row */
    }

    tbody tr {
        background: white;
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        padding: 10px;
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: left;
        white-space: normal;
    }

    td::before {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 45%;
        white-space: nowrap;
        font-weight: bold;
        color: var(--secondary-color);
    }

    /* Labels for each cell */
    td:nth-of-type(1)::before { content: "Today Date"; }
    td:nth-of-type(2)::before { content: "Driver Name"; }
    td:nth-of-type(3)::before { content: "Phone Number"; }
    td:nth-of-type(4)::before { content: "Car Name/Number"; }
    td:nth-of-type(5)::before { content: "Current Km"; }
    td:nth-of-type(6)::before { content: "Return Km"; }
    td:nth-of-type(7)::before { content: "Fare"; }
    td:nth-of-type(8)::before { content: "Driver Commission"; }
    td:nth-of-type(9)::before { content: "Owner Commission"; }
    td:nth-of-type(10)::before { content: "Pickup Date"; }
    td:nth-of-type(11)::before { content: "Pickup Time"; }
    td:nth-of-type(12)::before { content: "Return Time"; }
    td:nth-of-type(13)::before { content: "Place"; }
    td:nth-of-type(14)::before { content: "Actions"; }
}

