/* Base styles */
:root {
    --primary-color: #4a6fa5;
    --primary-gradient: linear-gradient(135deg, #5c8dd6, #4a6fa5);
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #e74c3c;
    --danger-gradient: linear-gradient(135deg, #ff7675, #e74c3c);
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --highlight-color: #3498db;
    --highlight-gradient: linear-gradient(135deg, #74b9ff, #3498db);
    --accent-color: #9b59b6;
    --accent-gradient: linear-gradient(135deg, #a29bfe, #9b59b6);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--bg-color);
    background-image: radial-gradient(#e8f0ff 1px, transparent 1px);
    background-size: 20px 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--primary-gradient);
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow);
    text-align: center;
    animation-duration: 1s;
}

.login-box h1 {
    margin-bottom: 30px;
    color: var(--dark-color);
    font-weight: 600;
}

.login-box h1 span {
    color: var(--primary-color);
}

.login-box .form-group {
    margin-bottom: 25px;
    text-align: left;
}

.reset-option {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}

.small-text {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

/* Header styles */
header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 1rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    animation-duration: 0.5s;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

header h1 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

header h1 span {
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#current-user {
    font-weight: 500;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--dark-color);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 25px;
    transition: all var(--transition-speed) ease;
    font-weight: 500;
    display: block;
}

nav a:hover {
    background-color: rgba(74, 111, 165, 0.1);
    transform: translateY(-2px);
}

nav a.active {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 8px rgba(74, 111, 165, 0.3);
}

/* Main section styles */
main {
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.section {
    display: none;
    animation-duration: 0.5s;
}

.section.active {
    display: block;
}

.section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    position: relative;
    display: inline-block;
}

.section h2::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 3px;
    background: var(--primary-gradient);
    bottom: -8px;
    left: 0;
    border-radius: 3px;
}

/* Card styles */
.card {
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.card h4 {
    color: var(--dark-color);
    margin: 1rem 0;
    font-weight: 500;
}

.danger-card {
    border-left: 4px solid var(--danger-color);
}

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.input-fancy {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all var(--transition-speed) ease;
    font-family: 'Poppins', sans-serif;
}

.input-fancy:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
    outline: none;
}

select.input-fancy {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}

/* Button styles */
.btn-rounded {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-rounded.primary {
    background: var(--primary-gradient);
    color: #fff;
}

.btn-rounded.secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-rounded.danger {
    background: var(--danger-gradient);
    color: #fff;
}

.btn-rounded:hover {
    opacity: 0.9;
    transform: translateY(-3px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.btn-rounded:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Home section styles */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    width: 100%;
    height: 300px;
    animation-duration: 1s;
    animation-delay: 0.3s;
}

.summary-container h2, .record-driving h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#summary-list {
    padding: 1rem;
}

.record-driving {
    margin-top: 2rem;
}

/* History section styles */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.history-list table {
    width: 100%;
    border-collapse: collapse;
}

.history-list th, .history-list td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-list th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--primary-color);
}

.history-list tr:hover {
    background-color: rgba(74, 111, 165, 0.05);
}

/* Debt Tracker styles */
.debt-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.balance-display {
    font-size: 2rem;
    font-weight: 600;
    margin: 1rem 0;
    text-align: center;
    padding: 1rem;
    border-radius: 10px;
}

.balance-display.credit {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.balance-display.debt {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.balance-display.balanced {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.balances-list {
    display: grid;
    gap: 1rem;
}

.balance-item {
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.balance-item.credit {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-left: 3px solid #28a745;
}

.balance-item.debt {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border-left: 3px solid #e74c3c;
}

.balance-item.balanced {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border-left: 3px solid #ffc107;
}

/* Admin section styles */
.admin-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.user-card-list {
    list-style: none;
}

.user-card-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background-color: var(--light-color);
    transition: all var(--transition-speed) ease;
}

.user-card-list li:hover {
    transform: translateX(5px);
    background-color: #edf2f7;
}

.user-card-list .user-info {
    flex-grow: 1;
}

.user-card-list .user-info .admin-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.danger-zone {
    text-align: center;
    padding: 1rem;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
    animation-duration: 0.4s;
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Error messages */
.error {
    color: var(--danger-color);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Summary item styles */
.summary-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.summary-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.credit {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-left: 3px solid #28a745;
}

.debt {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border-left: 3px solid #e74c3c;
}

.balanced {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border-left: 3px solid #ffc107;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.5s ease-in-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive styles */
@media (max-width: 768px) {
    .stats-container,
    .debt-dashboard,
    .admin-dashboard {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    nav ul {
        justify-content: center;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .user-info {
        margin-top: 1rem;
        justify-content: center;
    }
}

/* Calendar styles */
.calendar-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.calendar-container {
    overflow-x: auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 1.5rem;
}

.calendar-day {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 100px;
    padding: 5px;
    position: relative;
    transition: all 0.2s ease;
}

.calendar-day:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day-header {
    font-weight: 600;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    background-color: var(--light-color);
    margin-bottom: 5px;
}

.calendar-day-number {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-day-driver {
    margin-top: 25px;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.calendar-day.inactive {
    background-color: #f8f9fa;
    opacity: 0.6;
}

.calendar-day.today {
    border: 2px solid var(--highlight-color);
}

.calendar-day.holiday {
    background-color: rgba(255, 193, 7, 0.1);
    border: 2px dashed #ffc107;
}

.holiday-info {
    position: absolute;
    top: 30px;
    left: 5px;
    right: 5px;
    font-size: 0.8rem;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 3px 5px;
    border-radius: 4px;
    text-align: center;
    color: #856404;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
}

.calendar-day:hover .holiday-info {
    white-space: normal;
    overflow: visible;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #fff;
}

.calendar-legend {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 1rem 0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
}

.holiday-legend {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.holiday-indicator {
    width: 30px;
    height: 20px;
    border-radius: 5px;
    background-color: rgba(255, 193, 7, 0.1);
    border: 2px dashed #ffc107;
    margin-right: 8px;
}

/* Holiday styles */
.holiday-form {
    margin-bottom: 2rem;
}

.holidays-list table {
    width: 100%;
    border-collapse: collapse;
}

.holidays-list th, .holidays-list td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.holidays-list th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--primary-color);
}

.holidays-list tr:hover {
    background-color: rgba(74, 111, 165, 0.05);
}

/* Server sync status indicator */
.sync-status {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    margin-left: 10px;
}

.sync-status.online {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.sync-status.offline {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
} 