/* assets/css/style.css */
/* Additional styles can go here */

/* Global modal layer contract: popups must stay above sidebar, map panels,
   notification panels, and mobile overlays. */
body > .swal2-container {
    z-index: 2147483646 !important;
    pointer-events: auto !important;
}

body.swal2-shown #sidebar-overlay,
body.swal2-shown .topbar-notification-panel {
    pointer-events: none !important;
}

.map-marker-label {
    background: white;
    border: 1px solid #333;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
}

/* =========================================
   SweetAlert2 Dark/Premium Theme Overrides
   ========================================= */
body .swal2-popup {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18) !important;
}

body .swal2-title {
    color: #0f172a !important;
    font-size: 1.6em !important;
    font-weight: 600 !important;
}

body .swal2-html-container {
    color: #475569 !important;
}

body .swal2-close {
    color: #64748b !important;
}

body .swal2-close:hover {
    color: #0f172a !important;
}

/* Form Inputs inside SweetAlert */
body .swal2-popup .swal-label,
body .swal2-popup label {
    color: #475569 !important;
    font-weight: 500 !important;
}

body .swal2-popup .custom-input,
body .swal2-popup .custom-select,
body .swal2-popup input:not([type="checkbox"]):not([type="radio"]),
body .swal2-popup select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

body .swal2-popup .custom-input:focus,
body .swal2-popup .custom-select:focus,
body .swal2-popup input:not([type="checkbox"]):not([type="radio"]):focus,
body .swal2-popup select:focus {
    border-color: #3b82f6 !important; /* Blue 500 */
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

/* Select2 Dark Mode Fixes within SweetAlert */
body .swal2-popup .select2-container .select2-selection--single {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    height: 48px !important;
    border-radius: 10px !important;
}

body .swal2-popup .select2-container .select2-selection--single .select2-selection__rendered {
    color: #0f172a !important;
    line-height: 46px !important;
}

body .swal2-popup .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #64748b transparent transparent transparent !important;
    top: 50%;
}

body .select2-dropdown {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

body .select2-results__option {
    color: #1e293b !important;
    background-color: #ffffff !important;
}

/* แก้ไขปัญหา background สีขาวเวลาเลือกหรือ hover ทำให้มองไม่เห็นตัวหนังสือ */
body .select2-results__option[aria-selected="true"] {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

body .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6 !important; /* สีฟ้าตอนเอาเมาส์ชี้ */
    color: #ffffff !important;
}

body .select2-search__field {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* Select2 global light-mode fix for user/report pages */
body:not(.dark-mode) .select2-container--default .select2-selection--single {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    color: #0f172a !important;
}

body:not(.dark-mode) .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    padding-left: 14px !important;
    padding-right: 34px !important;
}

body:not(.dark-mode) .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

body:not(.dark-mode) .select2-container--default .select2-selection--single .select2-selection__clear {
    display: none !important;
}

body:not(.dark-mode) .select2-dropdown,
body:not(.dark-mode) .select2-search--dropdown {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body:not(.dark-mode) .select2-search--dropdown .select2-search__field {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body:not(.dark-mode) .select2-results__option,
body:not(.dark-mode) .select2-container--default .select2-results__option {
    background-color: #ffffff !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body:not(.dark-mode) .select2-results__option[aria-selected="true"],
body:not(.dark-mode) .select2-container--default .select2-results__option--selected {
    background-color: #e0ecff !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body:not(.dark-mode) .select2-results__option--highlighted[aria-selected],
body:not(.dark-mode) .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #2563eb !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Button Upgrades */
body .swal2-confirm {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2) !important;
}

body .swal2-cancel {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}

body .swal2-cancel:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* =========================================
   Modern Ocean Glassmorphism System & Overrides
   ========================================= */

:root {
    --ocean-primary: #0284c7;
    --ocean-primary-hover: #0369a1;
    --ocean-accent: #38bdf8;
    --ocean-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    --ocean-light-bg: #f0f9ff;
    --ocean-card-bg: rgba(255, 255, 255, 0.9);
    --ocean-border: rgba(224, 242, 254, 0.8);
    --ocean-shadow: 0 10px 30px rgba(2, 132, 199, 0.08);
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1e293b;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 50%, #f8fafc 100%) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
}

/* Global Buttons UI - Glass & Oceanic Gradients */
button, .btn, .btn-primary, .btn-secondary, .btn-info, .btn-success {
    font-size: 13px !important;
    padding: 8px 18px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2) !important;
}

.btn-primary, button[type="submit"]:not(.login-btn) {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
}

.btn-primary:hover, button[type="submit"]:not(.login-btn):hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35) !important;
}

.btn-secondary, .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.85) !important;
    color: #0369a1 !important;
    border: 1px solid rgba(186, 230, 253, 0.8) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.btn-secondary:hover {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    transform: translateY(-1px) !important;
}

/* Password visibility controls */
button[data-password-toggle-target],
button[data-password-toggle-target]:hover,
button[data-password-toggle-target]:focus-visible,
button[data-password-toggle-target]:active {
    transform: none !important;
    box-shadow: none !important;
}

button.password-toggle-btn,
button.password-toggle-btn:hover,
button.password-toggle-btn:focus-visible,
button.password-toggle-btn:active {
    transform: translateY(-50%) !important;
    box-shadow: none !important;
}

/* Inputs & Form Controls (Glass Pill) */
input[type="text"], input[type="date"], input[type="number"], input[type="password"], select, textarea, .custom-input, .custom-select, .form-control {
    font-size: 13px !important;
    padding: 10px 16px !important;
    border-radius: 12px !important;
    border: 1px solid #bae6fd !important;
    font-weight: 400 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.03) !important;
    color: #0f172a !important;
}

input:focus, select:focus, textarea:focus, .form-control:focus {
    background: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.18) !important;
    outline: none !important;
}

/* Glass Cards & Containers */
.card, .panel,
div[style*="background: white"], 
div[style*="background-color: white"],
div[style*="background: #fff"],
div[style*="background-color: #fff"] {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(224, 242, 254, 0.8) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.06) !important;
}

/* Data Tables - Rounded Glass Styling */
table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    border: 1px solid #e0f2fe !important;
    border-radius: 14px !important;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.05);
}

table th, table td {
    font-size: 13px !important;
    padding: 12px 18px !important;
    border-bottom: 1px solid #f0f9ff !important;
    color: #334155;
}

table thead th {
    font-weight: 700 !important;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
    color: #0369a1 !important;
    text-transform: uppercase;
    font-size: 11px !important;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #93c5fd !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
}

table tbody tr:hover td {
    background-color: #f0f9ff !important;
}

/* Labels and Badges */
label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #0369a1 !important;
    margin-bottom: 6px;
    display: block;
}

.badge {
    padding: 6px 12px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    letter-spacing: 0.03em;
}

/* Dark Mode Overrides */
body.dark-mode {
    background: linear-gradient(135deg, #075985 0%, #0f172a 100%) !important;
    color: #f8fafc !important;
}

body.dark-mode .card,
body.dark-mode div[style*="background: white"], 
body.dark-mode div[style*="background-color: white"] {
    background: rgba(15, 23, 42, 0.85) !important;
    border-color: #1e293b !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode table {
    border-color: #1e293b !important;
    background: rgba(15, 23, 42, 0.9) !important;
}

body.dark-mode table thead th {
    background: #0f172a !important;
    color: #38bdf8 !important;
    border-bottom: 1px solid #1e293b !important;
}

body.dark-mode table th, body.dark-mode table td {
    border-bottom: 1px solid #1e293b !important;
    color: #cbd5e1;
}
