/* ============================================================
   MeteoTua Design System — style.css
   Meteorological Monitoring Web Application
   ============================================================ */

/* ----------------------------------------
   Google Fonts + Remix Icon
   ---------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;800&family=Manrope:wght@400;500;600&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@4.1.0/fonts/remixicon.css');

/* ----------------------------------------
   1. CSS Variables
   ---------------------------------------- */
:root {
    --primary: #0e7c61;
    --primary-light: #11967a;
    --primary-dark: #0a5e4a;
    --bluette: #5bb4a0;
    --bluette-light: #7ec8b8;
    --neutro: #f0f7f5;
    --success: #15bd64;
    --danger: #dc2828;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f8faf9;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --header-h: 70px;
    --menu-h: 50px;
    --footer-h: 60px;
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Manrope', sans-serif;
    --transition: 0.25s ease;
}

/* ----------------------------------------
   2. Reset + Base
   ---------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* ----------------------------------------
   3. Grid System
   ---------------------------------------- */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.row > [class*="col-"] {
    padding: 0 10px;
    margin-bottom: 20px;
}

.col-12 { width: 100%; }
.col-6  { width: 50%; }

@media (min-width: 768px) {
    .col-md-3  { width: 25%; }
    .col-md-4  { width: 33.3333%; }
    .col-md-6  { width: 50%; }
    .col-md-8  { width: 66.6667%; }
    .col-md-12 { width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-2  { width: 16.6667%; }
    .col-lg-3  { width: 25%; }
    .col-lg-4  { width: 33.3333%; }
    .col-lg-6  { width: 50%; }
    .col-lg-8  { width: 66.6667%; }
    .col-lg-9  { width: 75%; }
    .col-lg-12 { width: 100%; }
}

/* ----------------------------------------
   4. Header (.header-nav)
   ---------------------------------------- */
.header-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-nav .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
}

.header-nav .brand img {
    height: 38px;
    width: auto;
}

.header-nav .brand-subtitle {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.75;
    display: block;
    font-family: var(--font-body);
}

.header-nav .nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-nav .nav-actions .nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
    transition: background var(--transition);
}

.header-nav .nav-actions .nav-btn:hover {
    background: rgba(255,255,255,0.25);
}

.header-nav .nav-actions .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    object-fit: cover;
}

.header-nav .nav-actions .user-name {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ----------------------------------------
   5. Horizontal Menu (.horizontal-menu)
   ---------------------------------------- */
.horizontal-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    height: var(--menu-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 999;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-menu::-webkit-scrollbar {
    display: none;
}

.horizontal-menu .menu-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
    text-decoration: none;
}

.horizontal-menu .menu-link i {
    font-size: 1.1rem;
}

.horizontal-menu .menu-link:hover {
    color: var(--primary);
    background: var(--neutro);
}

.horizontal-menu .menu-link.active {
    color: var(--primary);
    font-weight: 600;
    border-bottom-color: var(--primary);
    background: var(--neutro);
}

/* ----------------------------------------
   6. Main Content Area
   ---------------------------------------- */
.main-content {
    padding-top: 120px; /* header 70 + menu 50 */
    padding-bottom: calc(var(--footer-h) + 24px);
    min-height: 100vh;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    margin-bottom: 4px;
}

.page-header .page-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ----------------------------------------
   7. Breadcrumbs (.breadcrumbs)
   ---------------------------------------- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.breadcrumbs a {
    color: var(--text-light);
    transition: color var(--transition);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .separator {
    font-size: 0.65rem;
    opacity: 0.5;
}

.breadcrumbs .separator::after {
    content: '\ea6e'; /* ri-arrow-right-s-line */
    font-family: 'remixicon';
}

.breadcrumbs .current {
    color: var(--text);
    font-weight: 600;
}

/* ----------------------------------------
   8. Metric Cards (.metric-card)
   ---------------------------------------- */
.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: var(--neutro);
    color: var(--primary);
}

.metric-card .metric-icon.icon-success { background: #dcfce7; color: var(--success); }
.metric-card .metric-icon.icon-danger  { background: #fef2f2; color: var(--danger); }
.metric-card .metric-icon.icon-warning { background: #fffbeb; color: var(--warning); }
.metric-card .metric-icon.icon-info    { background: #eff6ff; color: var(--info); }

.metric-card .metric-body {
    flex: 1;
    min-width: 0;
}

.metric-card .metric-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
}

.metric-card .metric-label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 2px;
}

.metric-card .metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 20px;
}

.metric-card .metric-trend.trend-up {
    color: var(--success);
    background: #dcfce7;
}

.metric-card .metric-trend.trend-down {
    color: var(--danger);
    background: #fef2f2;
}

.metric-card .metric-trend.trend-neutral {
    color: var(--text-light);
    background: var(--neutro);
}

/* ----------------------------------------
   9. Buttons (.btn)
   ---------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
    color: #fff;
}

.btn-secondary {
    background: var(--neutro);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #12a758;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.1rem;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
}

/* ----------------------------------------
   10. Alerts (.alert)
   ---------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert i {
    font-size: 1.2rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* ----------------------------------------
   11. Data Tables (.data-table)
   ---------------------------------------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.data-table thead th {
    background: var(--neutro);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.data-table thead th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 24px;
}

.data-table thead th.sortable::after {
    content: '\eb74'; /* ri-arrow-up-down-line */
    font-family: 'remixicon';
    position: absolute;
    right: 8px;
    font-size: 0.85rem;
    opacity: 0.4;
}

.data-table thead th.sort-asc::after {
    content: '\ea74'; /* ri-arrow-up-line */
    opacity: 1;
    color: var(--primary);
}

.data-table thead th.sort-desc::after {
    content: '\ea4c'; /* ri-arrow-down-line */
    opacity: 1;
    color: var(--primary);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
    background: var(--neutro);
}

.data-table tbody tr:hover {
    background: #e6f4f0;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ----------------------------------------
   12. Badges (.badge)
   ---------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fef2f2;
    color: #991b1b;
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.badge-info {
    background: #eff6ff;
    color: #1e40af;
}

.badge-secondary {
    background: var(--neutro);
    color: var(--text-light);
}

.badge-primary {
    background: #e0f2ed;
    color: var(--primary);
}

/* ----------------------------------------
   13. Status Dots (.status-dot)
   ---------------------------------------- */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.dot-success { background: var(--success); }
.status-dot.dot-danger  { background: var(--danger); }
.status-dot.dot-warning { background: var(--warning); }
.status-dot.dot-info    { background: var(--info); }
.status-dot.dot-neutral { background: var(--text-light); }

.status-dot.dot-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
}

/* ----------------------------------------
   14. Forms
   ---------------------------------------- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group .form-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,124,97,0.12);
}

.form-control::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,40,40,0.12);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.84rem;
    cursor: pointer;
    margin-bottom: 0;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ----------------------------------------
   15. Cards (.card)
   ---------------------------------------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--neutro);
}

.card-header h3,
.card-header h4 {
    font-size: 0.95rem;
    margin: 0;
}

.card-header .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--neutro);
}

.card-flush {
    border: none;
    box-shadow: none;
}

.card-highlight {
    border-left: 4px solid var(--primary);
}

.card-highlight.card-success { border-left-color: var(--success); }
.card-highlight.card-danger  { border-left-color: var(--danger); }
.card-highlight.card-warning { border-left-color: var(--warning); }

/* ----------------------------------------
   16. Modal (.modal)
   ---------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.96);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.05rem;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--neutro);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-light);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ----------------------------------------
   17. Tabs (.tabs)
   ---------------------------------------- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tabs .tab-item {
    padding: 10px 20px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-body);
}

.tabs .tab-item:hover {
    color: var(--primary);
}

.tabs .tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ----------------------------------------
   18. Pagination (.pagination)
   ---------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination .page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
    transition: all var(--transition);
}

.pagination .page-btn:hover:not(.active):not(.disabled) {
    background: var(--neutro);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination .page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-left: 12px;
}

/* ----------------------------------------
   19. Footer (.site-footer)
   ---------------------------------------- */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 998;
}

.site-footer p {
    font-size: 0.76rem;
    color: var(--text-light);
}

.site-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* ----------------------------------------
   20. Toast Notifications
   ---------------------------------------- */
.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 300px;
    max-width: 420px;
    pointer-events: all;
    animation: slideIn 0.35s ease;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-success::before { background: var(--success); }
.toast-danger::before  { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-danger  .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast-body {
    flex: 1;
}

.toast-body .toast-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.toast-body .toast-message {
    font-size: 0.8rem;
    color: var(--text-light);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    flex-shrink: 0;
}

.toast.hide {
    animation: slideOut 0.3s ease forwards;
}

/* ----------------------------------------
   21. Sidebar Styles (Map page)
   ---------------------------------------- */
.sidebar-left,
.sidebar-right {
    position: fixed;
    top: 120px;
    bottom: var(--footer-h);
    width: 320px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-left {
    left: 0;
}

.sidebar-right {
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border);
}

.sidebar-left.collapsed {
    transform: translateX(-100%);
}

.sidebar-right.collapsed {
    transform: translateX(100%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.sidebar-header h4 {
    font-size: 0.92rem;
    margin: 0;
}

.sidebar-body {
    padding: 16px 18px;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    width: 24px;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    z-index: 101;
    transition: all var(--transition);
}

.sidebar-left + .sidebar-toggle {
    right: -24px;
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.sidebar-right + .sidebar-toggle {
    left: -24px;
    border-radius: 6px 0 0 6px;
    border-right: none;
}

/* ----------------------------------------
   22. Loader / Spinner
   ---------------------------------------- */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
    border-radius: var(--radius);
}

.loading-overlay .loading-text {
    font-size: 0.84rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ----------------------------------------
   23. Animations (@keyframes)
   ---------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

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

/* ----------------------------------------
   24. Utility Classes
   ---------------------------------------- */

/* Text alignment */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }

/* Text colors */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-light); }

/* Font weight */
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Margin top */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* Margin bottom */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* Margin left / right */
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.px-1 { padding-left: 8px; padding-right: 8px; }
.px-2 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 8px; padding-bottom: 8px; }
.py-2 { padding-top: 16px; padding-bottom: 16px; }

/* Flexbox */
.d-flex          { display: flex; }
.d-inline-flex   { display: inline-flex; }
.flex-column     { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.align-center    { align-items: center; }
.align-start     { align-items: flex-start; }
.align-end       { align-items: flex-end; }
.flex-1          { flex: 1; }

/* Gap */
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* Display */
.hidden     { display: none !important; }
.visible    { display: block !important; }
.d-none     { display: none; }
.d-block    { display: block; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Border */
.rounded    { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 50%; }
.border     { border: 1px solid var(--border); }
.border-0   { border: none; }

/* Shadow */
.shadow    { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

/* Width */
.w-100 { width: 100%; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----------------------------------------
   25. Scrollbar Styling
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ----------------------------------------
   26. Responsive — Tablet (768px)
   ---------------------------------------- */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .row > [class*="col-"] {
        width: 100%;
    }

    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8 {
        width: 100%;
    }

    .header-nav {
        padding: 0 16px;
    }

    .header-nav .brand {
        font-size: 1.1rem;
    }

    .header-nav .nav-actions .user-name {
        display: none;
    }

    .horizontal-menu {
        padding: 0 12px;
    }

    .horizontal-menu .menu-link {
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    .sidebar-left,
    .sidebar-right {
        width: 280px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .toast-container {
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }
}

/* ----------------------------------------
   27. Responsive — Mobile (576px)
   ---------------------------------------- */
@media (max-width: 576px) {
    :root {
        --header-h: 60px;
        --menu-h: 44px;
    }

    .main-content {
        padding-top: 104px; /* 60 + 44 */
    }

    .header-nav .brand img {
        height: 30px;
    }

    .header-nav .brand {
        font-size: 1rem;
    }

    .header-nav .brand-subtitle {
        display: none;
    }

    .header-nav .nav-actions .nav-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .horizontal-menu .menu-link span {
        display: none;
    }

    .horizontal-menu .menu-link {
        padding: 6px 10px;
    }

    .metric-card {
        padding: 16px;
    }

    .metric-card .metric-value {
        font-size: 1.3rem;
    }

    .metric-card .metric-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .card-header,
    .card-body {
        padding: 14px 16px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.82rem;
    }

    .sidebar-left,
    .sidebar-right {
        width: 100%;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }

    .page-header {
        margin-bottom: 16px;
    }

    .pagination .page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 0.78rem;
    }

    .tabs .tab-item {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* ----------------------------------------
   28. Print Styles
   ---------------------------------------- */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    .header-nav,
    .horizontal-menu,
    .site-footer,
    .sidebar-left,
    .sidebar-right,
    .toast-container,
    .modal-overlay,
    .btn,
    .pagination,
    .tabs {
        display: none !important;
    }

    .main-content {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .card {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .data-table {
        width: 100%;
        border-collapse: collapse;
    }

    .data-table thead th {
        border-bottom: 2px solid #000;
    }

    .data-table tbody td {
        border-bottom: 1px solid #ccc;
    }

    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
    }

    .container {
        max-width: 100%;
    }

    @page {
        margin: 1.5cm;
    }
}
