/**
 * style.css
 * สไตล์หลักของระบบ
 * กองช่าง เทศบาลเมืองเขลางค์นคร
 */

/* กำหนดฟอนต์หลัก */
body {
    font-family: 'Kanit', sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Sidebar Styles ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand i {
    font-size: 2.5rem;
    color: #ffc107;
    display: block;
    margin-bottom: 8px;
}

.sidebar-brand span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

/* User Info in Sidebar */
.sidebar-user {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    font-size: 2rem;
    color: #0dcaf0;
}

.user-name {
    font-weight: 500;
    font-size: 1rem;
}

.user-dept {
    color: rgba(255, 255, 255, 0.6);
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.menu-header {
    padding: 15px 20px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.sidebar-menu li {
    margin: 2px 10px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-menu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-menu li.active a {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.sidebar-menu li a i {
    font-size: 1.2rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-menu li a.text-danger:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545 !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 20px;
}

.main-content.has-sidebar {
    margin-left: 260px;
    padding: 30px;
}

/* ===== Footer ===== */
.footer {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.footer.has-sidebar {
    margin-left: 260px;
}

/* ===== Overlay for Mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content.has-sidebar {
        margin-left: 0;
        padding: 20px;
        padding-top: 80px;
    }
    
    .footer.has-sidebar {
        margin-left: 0;
    }
    
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 998;
    }
}

/* ===== Card Styling ===== */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 500;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 15px 20px;
}

/* ===== Stat Cards ===== */
.stat-card {
    border-radius: 12px;
    overflow: hidden;
    border: none;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
}

/* ===== Table Styling ===== */
.table {
    font-size: 0.95rem;
}

.table th {
    font-weight: 500;
    background-color: #f8f9fa;
    border-top: none;
    padding: 12px 15px;
}

.table td {
    padding: 12px 15px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* ===== Badge Styling ===== */
.badge {
    font-weight: 400;
    padding: 0.4em 0.7em;
    border-radius: 6px;
}

/* ===== Button Styling ===== */
.btn {
    border-radius: 8px;
    font-weight: 400;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #0aa2c0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* ===== Form Styling ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0.6rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ===== Alert Styling ===== */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.25rem;
}

/* ===== Breadcrumb Styling ===== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: #0d6efd;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* ===== Pagination Styling ===== */
.pagination .page-link {
    border: none;
    color: #0d6efd;
    border-radius: 8px;
    margin: 0 3px;
    padding: 0.5rem 0.9rem;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: white;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
}

/* ===== Dropdown Styling ===== */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: rgba(13, 110, 253, 0.08);
}

/* ===== Modal Styling ===== */
.modal-content {
    border-radius: 15px;
    border: none;
}

.modal-header {
    border-radius: 15px 15px 0 0;
    border-bottom: 1px solid #f0f0f0;
}

/* ===== Map Container ===== */
#map, #mapPicker, #miniMap {
    border-radius: 12px;
    overflow: hidden;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== Animation ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ===== Print Styling ===== */
@media print {
    .sidebar, .navbar, .btn, .no-print, .sidebar-overlay {
        display: none !important;
    }
    
    .main-content.has-sidebar,
    .footer.has-sidebar {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background-color: white;
    }
}

/* ===== Login Page Styling ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.logo-circle i {
    font-size: 40px;
    color: white;
}

.login-box .card {
    border-radius: 15px;
}

.login-box .form-control {
    border-radius: 10px;
}

.login-box .btn {
    border-radius: 10px;
}

.login-box .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.login-box .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}
