/* =========================================
   Fleet Admin – Global Styles
   Lys, moderne og responsiv UI
   Accent: #17be74
   ========================================= */

/* Reset & base */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: #f8f9fa;
    color: #333;
}

a {
    color: #17be74;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout containers */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #17be74 0%, #0ea960 100%);
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar h2 {
    padding: 1rem;
    margin: 0;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar nav {
    flex: 1;
}

.sidebar nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: white;
    transition: background 0.2s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255, 255, 255, 0.15);
}

.content {
    flex: 1;
    padding: 2rem;
}

/* Cards / panels */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    margin-top: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: #17be74;
    color: white;
}

.btn-primary:hover {
    background-color: #0ea960;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Forms */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #17be74;
    outline: none;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

/* DataTables tweaks */
table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

table.dataTable thead th {
    background: #e9ecef;
    border-bottom: 2px solid #dee2e6;
}

table.dataTable tbody tr:hover {
    background: #f1f3f5;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.modal-header {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.modal-actions {
    text-align: right;
    margin-top: 1rem;
}

/* ===== Mobile/off-canvas sidebar ===== */
.sidebar-backdrop{
    position:fixed; inset:0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(1px);
    z-index: 999; /* just under the sidebar */
    display:none;
}

@media (max-width: 992px){
    /* Keep the main layout vertical on mobile */
    .wrapper{
        flex-direction: column;
        min-height: 100dvh;
    }

    /* Off-canvas sidebar (hidden by default) */
    .sidebar{
        position: fixed;
        top: 0; left: 0;
        height: 100dvh;
        width: 280px;           /* a touch wider for fingers */
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1000;          /* above everything */
        box-shadow: 8px 0 20px rgba(0,0,0,.15);
    }

    /* When open */
    body.sidebar-open .sidebar{
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop{
        display:block;
    }

    /* Prevent background scroll when menu is open */
    body.sidebar-open{
        overflow: hidden;
        touch-action: none;
    }

    /* Nudge main content a bit smaller padding on mobile */
    .content{
        padding: 1rem;
    }

    /* Optional: bigger tap targets in the menu */
    .sidebar nav a{
        padding: 0.9rem 1rem;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
    .sidebar{ transition: none !important; }
}