/* assets/css/style.css - Stylesheet หลักสำหรับหน้าผู้ใช้ทั่วไป */

/* ==================== Variables ==================== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --font-thai: 'Sarabun', sans-serif;
}

/* ==================== Base Styles ==================== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-thai);
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

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

a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* ==================== Navbar Styles ==================== */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 600;
}

.navbar-brand i {
    margin-right: 8px;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* ==================== Card Styles ==================== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.card-header {
    font-weight: 600;
    border-bottom: 1px solid rgba(0,0,0,0.125);
}

.card-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

/* ==================== Form Styles ==================== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.6rem 1rem;
    font-family: var(--font-thai);
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-label .text-danger {
    font-size: 0.9em;
}

/* ==================== Button Styles ==================== */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0a58ca 0%, #0d6efd 100%);
}

/* ==================== Table Styles ==================== */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
    cursor: pointer;
}

/* ==================== Badge Styles ==================== */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    border-radius: 6px;
}

/* ==================== Alert Styles ==================== */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.alert-dismissible .btn-close {
    padding: 1.25rem;
}

/* ==================== Hero Section ==================== */
.bg-primary.text-white {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

/* ==================== Status Cards ==================== */
.border-warning {
    border-left: 4px solid var(--warning-color) !important;
}

.border-info {
    border-left: 4px solid var(--info-color) !important;
}

.border-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-primary {
    border-left: 4px solid var(--primary-color) !important;
}

/* ==================== Footer Styles ==================== */
footer {
    background-color: #212529;
    color: #fff;
    padding: 3rem 0 2rem;
    margin-top: auto;
}

footer h5 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 1rem;
}

footer hr {
    border-color: rgba(255,255,255,0.2);
    margin: 2rem 0 1rem;
}

footer small {
    color: rgba(255,255,255,0.8);
}

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

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
}

/* ==================== Loading Spinner ==================== */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* ==================== Pagination ==================== */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
    border-radius: 6px;
    margin: 0 2px;
    font-weight: 500;
}

.page-link:hover {
    background-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==================== Form Validation ==================== */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

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

/* ==================== Tooltips ==================== */
.tooltip {
    font-family: var(--font-thai);
}

/* ==================== Modal Styles ==================== */
.modal-content {
    border: none;
    border-radius: 15px;
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.125);
    border-radius: 15px 15px 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.125);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    footer {
        text-align: center;
    }
    
    footer .text-md-end {
        text-align: center !important;
        margin-top: 1rem;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    body {
        background-color: white;
    }
    
    .navbar, footer, .btn, .alert-dismissible .btn-close {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .container-fluid {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .text-muted {
        color: #000 !important;
    }
}

/* ==================== Custom Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ==================== Success Message ==================== */
.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

/* ==================== File Upload ==================== */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
}

.form-control[type="file"]::-webkit-file-upload-button {
    padding: 0.375rem 0.75rem;
    margin: -0.375rem -0.75rem;
    margin-inline-end: 0.75rem;
    color: #212529;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-weight: 500;
}

.form-control[type="file"]::-webkit-file-upload-button:hover {
    background-color: #dae0e5;
}