:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text: #333;
    --border: #ddd;
    --danger: #dc3545;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body { background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

/* Login */
.login-container { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    position: relative; 
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.card { 
    background: rgba(255, 255, 255, 0.95); 
    padding: 2.5rem; 
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    width: 100%; 
    max-width: 420px; 
    text-align: center; 
    border: 1px solid rgba(255,255,255,0.5);
}
.card h1 { margin-bottom: 0.5rem; font-size: 1.8rem; color: #2c3e50; letter-spacing: -0.5px; }
.card p { color: #7f8c8d; margin-bottom: 2rem; font-size: 0.95rem; }

.card input { 
    width: 100%; 
    padding: 14px 16px; 
    margin: 8px 0 20px 0; 
    border: 2px solid #eef2f7; 
    border-radius: 8px; 
    font-size: 1rem; 
    transition: border-color 0.2s, background 0.2s;
    outline: none;
    background: #f8fafc;
}
.card input:focus { border-color: var(--primary); background: white; }

.card button { 
    width: 100%; 
    padding: 14px; 
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 1rem; 
    font-weight: 600; 
    transition: all 0.2s; 
    box-shadow: 0 4px 6px rgba(0,123,255,0.2);
}
.card button:hover { transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0,123,255,0.3); background: var(--primary-dark); }
.card button:active { transform: translateY(1px); }

#login-message { margin-top: 15px; font-size: 0.9rem; min-height: 20px; }

/* Dashboard */
header { 
    background: white; 
    padding: 1rem 2rem; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0; 
    z-index: 20;
}
.logo { 
    font-weight: 800; 
    font-size: 1.4rem; 
    color: #0f172a; 
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-right button { 
    padding: 8px 16px; 
    cursor: pointer; 
    background: transparent; 
    border-radius: 6px; 
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}
#user-email {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 20px;
}

#admin-btn { border: 1px solid #6c757d; color: #6c757d; }
#admin-btn:hover { background: #6c757d; color: white; }

#logout-btn { border: 1px solid var(--danger); color: var(--danger); }
#logout-btn:hover { background: var(--danger); color: white; }

main { flex: 1; padding: 1rem; display: flex; flex-direction: column; overflow: hidden; }

.toolbar { display: flex; gap: 20px; margin-bottom: 1rem; align-items: center; justify-content: space-between; flex-shrink: 0; }
.view-switcher { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.view-switcher button { border: none; background: white; padding: 8px 16px; border-right: 1px solid var(--border); border-radius: 0; }
.view-switcher button:last-child { border-right: none; }
.view-switcher button.active { background: var(--primary); color: white; }

.date-nav { display: flex; gap: 5px; align-items: center; }
.toolbar input[type="date"] { padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
.toolbar button { padding: 8px 12px; cursor: pointer; background: white; border: 1px solid var(--border); border-radius: 4px; }
.toolbar .primary-btn { background: var(--primary); color: white; border: none; }

/* Calendar */
.calendar-header { display: flex; padding-left: 60px; margin-bottom: 5px; font-weight: bold; color: #555; flex-shrink: 0; }
.day-header { flex: 1; text-align: center; padding: 5px; border-left: 1px solid transparent; font-size: 0.9rem; }

.calendar-container { 
    display: flex; 
    border: 1px solid var(--border); 
    background: white; 
    border-radius: 4px; 
    position: relative; 
    overflow-y: auto; 
    height: 600px; 
    flex-shrink: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE 10+ */
}
.calendar-container::-webkit-scrollbar { display: none; /* Chrome/Safari */ }

.time-labels { width: 60px; border-right: 1px solid var(--border); background: #f9f9f9; flex-shrink: 0; min-height: 100%; }
.time-label { height: 60px; border-bottom: 1px solid #eee; text-align: center; font-size: 0.8rem; padding-top: 5px; color: #666; }

.calendar-grid { flex: 1; position: relative; min-width: 300px; min-height: 100%; }
/* Day View */
.calendar-grid.day-view { display: block; }
/* Week View */
.calendar-grid.week-view { display: grid; grid-template-columns: repeat(7, 1fr); }

/* Grid Lines & Columns */
.grid-slot { height: 60px; border-bottom: 1px solid #f0f0f0; width: 100%; box-sizing: border-box; transition: background-color 0.1s; }
.grid-slot:hover { background-color: rgba(0, 123, 255, 0.1); cursor: pointer; }
.grid-slot.unavailable { background-color: #f8f9fa; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 50%, #eee 50%, #eee 75%, transparent 75%, transparent); background-size: 10px 10px; }

.day-column { border-left: 1px solid #f0f0f0; position: relative; display: block; height: 100%; }
.day-column:first-child { border-left: none; }
.day-column:hover { background-color: rgba(0, 123, 255, 0.03); }

/* Day View Grid Hover */
.calendar-grid.day-view { cursor: default; }
.calendar-grid.day-view:hover { background-color: rgba(0, 123, 255, 0.03); }

.reservation-card {
    position: absolute;
    left: 2px;
    right: 2px;
    background: #e3f2fd;
    border-left: 4px solid var(--primary);
    padding: 2px 5px;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.1s;
    z-index: 10;
}
.reservation-card:hover { z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.res-time { font-weight: bold; font-size: 0.75rem; display: block; }
.res-truck { font-weight: bold; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Reservation List (Bottom) */
.res-list-container { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eee; flex-shrink: 0; max-height: 200px; overflow-y: auto; }
.res-list-container h3 { margin-bottom: 0.5rem; color: #555; font-size: 1rem; }
.res-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }

.res-item { background: white; border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px; cursor: pointer; transition: all 0.2s; }
.res-item:hover { border-color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.res-item-header { display: flex; justify-content: space-between; font-size: 0.85rem; color: #777; margin-bottom: 5px; }
.res-item-truck { font-weight: bold; font-size: 1rem; color: var(--text); margin-bottom: 5px; }
.res-item-notes { font-size: 0.85rem; color: #666; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Footer */
.dashboard-wrapper { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.dashboard-footer { padding: 1rem; text-align: center; background: white; border-top: 1px solid var(--border); color: #777; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; }
.dashboard-footer img { height: 24px; opacity: 0.8; }

.login-footer { position: absolute; bottom: 20px; text-align: center; width: 100%; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 100; }
.modal.hidden { display: none; }
.modal-content { background: white; padding: 2rem; border-radius: 8px; width: 90%; max-width: 500px; position: relative; }
.close { position: absolute; top: 10px; right: 15px; font-size: 1.5rem; cursor: pointer; }
.modal form { display: flex; flex-direction: column; gap: 15px; margin-top: 15px; }
.modal label { font-weight: 500; font-size: 0.9rem; }
.modal input, .modal textarea { padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
.form-actions { display: flex; justify-content: space-between; margin-top: 10px; }
.primary-btn { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.danger-btn { background: var(--danger); color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.hidden { display: none !important; }

/* Mobile Tweaks */
@media (max-width: 600px) {
    .reservation-card { left: 5px; right: 5px; }
    .toolbar { flex-wrap: wrap; }
    .toolbar .primary-btn { width: 100%; margin-left: 0; margin-top: 5px; }
}

/* Admin Page Styles */
.admin-wrapper { padding: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-header h1 { font-size: 1.8rem; color: #2c3e50; letter-spacing: -0.5px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem; }

.admin-card { 
    background: white; 
    border-radius: 12px; 
    padding: 2rem; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); 
    border: 1px solid var(--border); 
    transition: transform 0.2s;
}
.admin-card:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(0,0,0,0.08); }

.admin-card h3 { margin-bottom: 1.5rem; color: var(--primary); border-bottom: 1px solid #eee; padding-bottom: 1rem; font-size: 1.2rem; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: #555; font-size: 0.9rem; }
.form-group input, .form-group select { 
    width: 100%; 
    padding: 12px; 
    border: 2px solid #eef2f7; 
    border-radius: 8px; 
    font-size: 1rem; 
    background: #f8fafc;
    transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); background: white; outline: none; }

.form-group small { display: block; margin-top: 0.5rem; color: #888; font-size: 0.85rem; }

.btn-secondary { 
    background: white; 
    border: 1px solid var(--border); 
    color: #555; 
    padding: 10px 20px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 500;
    transition: all 0.2s;
}
.btn-secondary:hover { background: #f8f9fa; color: #333; border-color: #ccc; }
