﻿/* ========================== */
/* Global Variables */
/* ========================== */
:root {
    --text-color-primary: #202124;
    --text-color-secondary: #757575;
    --button-primary: #424242;
    --divider-color: #E0E0E0;
    --background-color: #FFFFFF;
}

/* ========================== */
/* Base Styles */
/* ========================== */
body {
    font-family: var(--font-primary, 'Roboto', sans-serif);
    background-color: var(--background-color);
    color: var(--text-color-primary);
    margin: 0;
    font-size: 16px;
}

#saralraasta-ui {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--background-color);
    text-align: center;
}

/* ========================== */
/* MudBlazor Overrides */
/* ========================== */

/* Buttons */
.mud-button {
    border-radius: 0.6rem !important;
    font-weight: 600 !important;
    padding: 0 18px !important;
    height: 40px !important;
    transition: transform .2s ease, box-shadow .2s ease;
}

    .mud-button:hover:not([disabled]) {
        transform: translateY(-2px);
        box-shadow: 0 4px 10px rgba(0,0,0,.15);
    }

/* Cards & Paper */
.mud-card, .mud-paper {
    border-radius: 0.75rem !important;
    transition: box-shadow .2s ease;
}

    .mud-card:hover, .mud-paper:hover {
        box-shadow: 0 6px 18px rgba(0,0,0,.12);
    }

/* Tables */
.mud-table {
    border-collapse: separate !important;
    border-spacing: 0;
}

    .mud-table thead th {
        font-weight: 600;
        background-color: #FAFAFA;
        border-bottom: 2px solid #ECECEC;
    }

    .mud-table tbody tr:hover {
        background-color: #F2F7FF;
    }

.mud-table-cell {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

/* Text fields */
.mud-input-root {
    border-radius: 6px !important;
}

/* ========================== */
/* Utility Classes */
/* ========================== */
.centered-container,
.flex-row,
.flex-column {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-row {
    flex-direction: row;
}

.flex-column {
    flex-direction: column;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.px-4 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.hover-shadow:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* ========================== */
/* Map Styling */
/* ========================== */
.map-wrapper {
    height: 420px;
    overflow: hidden;
    border-radius: 10px;
    background-color: var(--background-color);
    position: relative;
}

.map-container {
    height: 360px;
    border-radius: 10px;
    overflow: hidden;
}

#map-all-orders {
    height: 100%;
    width: 100%;
}

.leaflet-container {
    z-index: 0 !important;
}

.leaflet-label-depot,
.leaflet-label-stop {
    max-width: 120px;
    white-space: normal;
    word-break: break-word;
    text-align: center;
}

/* ========================== */
/* Loader Overlay */
/* ========================== */
#loader-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--background-color);
    z-index: 9999;
    text-align: center;
}

    #loader-overlay .logo-img {
        width: 80px;
        margin-bottom: 12px;
    }

    #loader-overlay::after {
        content: "";
        display: block;
        width: 40px;
        height: 40px;
        border: 4px solid var(--divider-color);
        border-top-color: var(--button-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    #loader-overlay.hidden {
        display: none !important;
        pointer-events: none !important;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================== */
/* Drawer / Nav */
/* ========================== */
.main-drawer {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1300 !important;
    background-color: #F5F5F5 !important;
}

.mud-drawer, .mud-nav-link, .mud-nav-link span {
    color: #202124 !important;
}

.drawer-group {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    margin-top: 6px;
}

.drawer-link {
    border-radius: 8px;
    margin: 2px 6px;
    padding: 10px 14px !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

    .drawer-link:hover {
        background-color: rgba(0, 87, 231, 0.08) !important;
        box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05);
    }

.mud-nav-link-active {
    background-color: rgba(0, 87, 231, 0.15) !important;
    font-weight: 600 !important;
}

.drawer-footer {
    border-top: 1px solid var(--mud-palette-lines-default);
    background-color: #fafafa;
}

.drawer-user {
    color: var(--mud-palette-text-secondary) !important;
    font-size: 0.9rem;
}

.drawer-logout {
    color: var(--mud-palette-text-primary) !important;
    font-weight: 500;
}

/* ========================== */
/* Responsive Enhancements */
/* ========================== */
@media (max-width: 1024px) {
    body {
        font-size: 15px;
    }

    .form-container {
        max-width: 90%;
        padding: 16px;
    }

    .map-wrapper {
        height: 360px;
    }

    .map-container {
        height: 320px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    #saralraasta-ui {
        padding: 10px;
    }

        #saralraasta-ui .logo-img {
            max-width: 160px;
        }

    .form-container {
        max-width: 95%;
        padding: 12px;
    }

    .drawer {
        width: 200px;
    }

    .map-wrapper {
        height: 300px;
    }

    .map-container {
        height: 260px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    #saralraasta-ui .logo-img {
        max-width: 120px;
    }

    .form-container {
        max-width: 100%;
        padding: 10px;
    }

    /* AppBar responsive fix */
    .mud-app-bar {
        display: flex;
        flex-direction: column !important;
        flex-wrap: wrap;
        align-items: flex-start;
        height: auto !important;
        min-height: 56px;
        padding: 8px 12px;
    }

        .mud-app-bar .mud-stack {
            width: 100%;
            justify-content: space-between;
        }

        .mud-app-bar img.logo-img {
            max-height: 40px;
            margin-bottom: 6px;
        }

    .map-wrapper {
        height: 240px;
    }

    .map-container {
        height: 200px;
    }

    .mud-tooltip {
        display: none !important;
        pointer-events: none !important;
    }
}

/* ========================== */
/* Layout & Content */
/* ========================== */
.app-layout {
    min-height: 100vh;
    background-color: var(--mud-palette-background-default);
}

.app-bar-blur {
    background-color: rgba(255, 255, 255, 0.92) !important; /* semi-transparent */
    backdrop-filter: blur(8px); /* soft glass effect */
    border-bottom: 1px solid rgba(0,0,0,0.08);
    z-index: 1100; /* keep it above content */
}

/* Single container rule (deduped) */
.mud-container {
    padding-top: 1rem;
    padding-bottom: 2rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 768px) {
    .mud-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

.mud-main-content {
    transition: margin-left 0.3s ease;
}

/* ========================== */
/* Table Row Consistency */
/* ========================== */
.mud-table thead th {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    vertical-align: middle !important;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.mud-table tbody td {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    vertical-align: middle !important;
    font-size: 0.95rem;
    line-height: 1.4;
}

.mud-table-dense thead th {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.mud-table-dense tbody td {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* ========================== */
/* Helpers */
/* ========================== */
.border-error {
    border: 2px solid #f44336 !important;
}

.border-default {
    border: 1px solid #ddd !important;
}

.bg-light {
    background: #fafafa !important;
}

.hover-shadow-sm:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.order-selection-table .mud-table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
}

.alert-min {
    min-width: 220px;
    border-radius: 8px;
}

.search-bar {
    width: 300px;
    max-width: 100%;
}

.chip-ellipsis {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.error-loading-wrapper {
    position: relative;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.wrapped-content {
    transition: opacity 0.2s ease-in-out;
}

/* Right stack helper */
.right-stack {
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .right-stack {
        justify-content: flex-start !important;
        width: 100%;
        margin-top: 6px;
    }
}

