/* 
   Molto Modern Design System
   A premium, glassmorphism-inspired UI for Molto Route Endpoint.
*/

:root {
    --primary: #007AFF;
    --primary-gradient: linear-gradient(135deg, #007AFF, #0056b3);
    --bg-main: #F5F7FA;
    --surface: rgba(255, 255, 255, 0.85);
    --surface-solid: #ffffff;
    --sidebar-bg: #1A1C1E;
    --sidebar-text: #E1E2E5;
    --sidebar-active: #2C2E33;
    --text-main: #1A1C1E;
    --text-muted: #6C757D;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 16px rgba(0,0,0,0.08);
    --glass-blur: 10px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', 'IBM Plex Sans Thai', sans-serif !important;
    font-size: 16px;
    font-weight: 400 !important;
    margin: 0;
    padding: 0;
}

/* Layout Structure */
.modern-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.modern-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s ease;
}

.modern-sidebar .brand {
    padding: 0 1.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modern-nav {
    flex: 1;
    overflow-y: auto;
}

.modern-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modern-nav-item {
    padding: 1.15rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 1.6rem; /* Increased from 1.3rem */
    font-weight: 500;
}

.modern-nav-item:hover {
    background-color: rgba(255,255,255,0.05);
    color: white;
    text-decoration: none;
}

.modern-nav-item.active {
    background-color: var(--sidebar-active);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.modern-nav-group {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 1.2rem; /* Increased from 0.95rem */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}

.modern-nav-group:hover {
    color: white;
}

.modern-nav-group::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    transition: transform 0.3s;
    font-size: 1rem;
}

.modern-nav-group.collapsed::after {
    transform: rotate(-90deg);
}

.nav-section {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-section.collapsed {
    max-height: 0 !important;
}

/* Main Content */
.modern-main {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.modern-header {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cards & Panels */
.modern-card {
    background: var(--surface-solid);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-modern {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-modern-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-modern-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,122,255,0.3);
    color: white;
}

/* DataTables Overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 4px 12px;
    margin-bottom: 1rem;
}

table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    background: transparent !important;
}

table.dataTable thead th {
    background: #f1f3f5 !important;
    border: none !important;
    padding: 12px 16px !important;
    font-weight: 600 !important;
    color: var(--text-muted);
}

table.dataTable tbody tr {
    background: white !important;
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
}

table.dataTable tbody td {
    border: none !important;
    padding: 12px 16px !important;
}

table.dataTable tbody tr td:first-child { border-radius: 8px 0 0 8px; }
table.dataTable tbody tr td:last-child { border-radius: 0 8px 8px 0; }

/* Tabs */
.modern-tabs {
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 2rem;
}

.modern-tab-link {
    padding: 0.75rem 0;
    color: var(--text-muted);
    text-decoration: none !important;
    font-weight: 500;
    position: relative;
    cursor: pointer;
}

.modern-tab-link.active {
    color: var(--primary);
}

.modern-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

/* Utility */
.text-premium {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* --- GLOBAL OVERRIDES FOR LEGACY PAGES --- */

/* Automatic Card-ification of Panels */
.panel, .well, .jumbotron {
    background: var(--surface-solid) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    padding: 1.5rem !important;
    margin-bottom: 2rem !important;
}

.panel-heading {
    background: transparent !important;
    border-bottom: 1px solid #eee !important;
    padding: 0 0 1rem 0 !important;
    margin-bottom: 1rem !important;
}

.panel-title {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--text-main) !important;
}

/* Button Normalization */
.btn {
    border-radius: 8px !important;
    padding: 0.6rem 1.25rem !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    border: none !important;
    text-transform: none !important;
}

.btn-primary { background: var(--primary-gradient) !important; color: white !important; }
.btn-success { background: linear-gradient(135deg, #40c057, #2f9e44) !important; color: white !important; }
.btn-danger { background: linear-gradient(135deg, #fa5252, #e03131) !important; color: white !important; }
.btn-warning { background: linear-gradient(135deg, #fab005, #f08c00) !important; color: white !important; }

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    filter: brightness(1.1);
}

/* Form Normalization */
.form-control {
    border-radius: 8px !important;
    border: 1px solid #dee2e6 !important;
    padding: 0.6rem 1rem !important;
    height: auto !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15) !important;
}

/* Table Normalization */
.table {
    width: 100% !important;
    margin-bottom: 1rem !important;
    background-color: transparent !important;
}

.table thead th {
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    padding: 1rem !important;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 1rem !important;
    vertical-align: middle !important;
    border-top: 1px solid #f1f3f5 !important;
    font-size: 1.3rem !important; /* Global table font boost */
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,0.02) !important;
}

.modern-route-table th, 
.modern-route-table td {
    padding: 1.25rem 1rem !important;
    vertical-align: top !important;
    font-size: 1.4rem !important; /* Increased from 1.1rem */
}

/* Priority for Remark column */
.modern-route-table td:nth-child(5), 
.modern-route-table td:nth-child(6) {
    font-size: 1.3rem !important; /* Increased from 1rem */
    color: var(--text-main);
    line-height: 1.6;
    min-width: 350px; /* Ensure enough horizontal space */
}

/* Compact specific small columns */
.modern-route-table th:first-child, 
.modern-route-table td:first-child,
.modern-route-table th:nth-child(3),
.modern-route-table td:nth-child(3) {
    width: 50px !important;
    text-align: center;
}

.modern-route-table .btn-modern {
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 600;
    width: auto;
    min-width: 120px;
    margin-bottom: 8px;
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 700;
}

/* --- RESPONSIVENESS --- */
@media (max-width: 991px) {
    .modern-sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    }

    .modern-sidebar.show {
        transform: translateX(0);
    }

    .modern-main {
        margin-left: 0 !important;
        padding: 1rem;
    }

    .modern-header {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    .modern-header h2 {
        font-size: 1.1rem;
    }

    .btn-mobile-toggle {
        display: flex !important;
    }

    .modern-card {
        padding: 1rem;
    }

    .modern-tabs {
        overflow-x: auto;
        white-space: nowrap;
        gap: 1.5rem;
        padding-bottom: 5px;
    }

    .typed-text {
        font-size: 2rem;
    }
}

.btn-mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-mobile-toggle:hover {
    background: rgba(0,0,0,0.05);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.show {
    display: block;
}

/* Modal Fixes */
/*.modal {
    z-index: 2050 !important;
}
.modal-backdrop {
    z-index: 2040 !important;
}*/
.modal-content {
    background-color: white !important;
    box-shadow: var(--shadow-lg), 0 20px 40px rgba(0,0,0,0.15) !important;
}
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

