/*===============================================
  Dashboard CSS for wellbeingdesign.net
  Color Scheme: ขาว + น้ำตาลเข้ม + เขียวเข้ม
  Font: Google Fonts "Kanit"
  ===============================================*/

/* Import Google Fonts - Kanit */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

/* Root Variables */
:root {
    --primary-color: #1a5f3f;         /* เขียวเข้ม */
    --secondary-color: #4a3228;       /* น้ำตาลเข้ม */
    --accent-color: #2d8659;          /* เขียวอ่อน */
    --light-bg: #f8f9fa;              /* ขาวอ่อน */
    --white: #ffffff;                 /* ขาว */
    --dark-brown: #3d2817;            /* น้ำตาลเข้มมาก */
    --light-brown: #6b4f3d;           /* น้ำตาลอ่อน */
    --success: #28a745;               /* สีสำเร็จ */
    --danger: #dc3545;                /* สีอันตราย */
    --warning: #ffc107;               /* สีเตือน */
    --info: #17a2b8;                  /* สีข้อมูล */
    --text-dark: #1a5f3f;             /* ตัวอักษรเขียวเข้ม */
    --text-brown: #4a3228;            /* ตัวอักษรน้ำตาล */
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

/* Login Page Styles */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: var(--white);
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-header h2 {
    color: var(--white);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.login-body {
    padding: 2.5rem 2rem;
}

.form-control {
    font-family: 'Kanit', sans-serif;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 63, 0.15);
}

.form-label {
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.btn-login {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 0.85rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

.btn-login:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-login:disabled {
    background: var(--primary-color);
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.btn-line {
    background: #00B900;
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 0.85rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-line:hover {
    background: #00a000;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 1rem;
    color: var(--text-brown);
    font-size: 0.9rem;
}

.alert {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-family: 'Kanit', sans-serif;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Dashboard Styles */
.dashboard-wrapper {
    min-height: 100vh;
    background-color: var(--light-bg);
}

.sidebar {
    background: linear-gradient(180deg, var(--secondary-color) 0%, var(--dark-brown) 100%);
    color: var(--white);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    padding: 2rem 0;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    color: var(--white);
    margin: 0;
    font-size: 1.5rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-menu i {
    font-size: 1.2rem;
    width: 20px;
}

.main-content {
    margin-left: 280px;
    padding: 2rem;
}

.top-navbar {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-details h6 {
    margin: 0;
    color: var(--text-dark);
    font-weight: 600;
}

.user-details span {
    color: var(--text-brown);
    font-size: 0.85rem;
}

.dashboard-card {
    background: var(--white);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card {
    background: var(--white);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--white);
}

.stat-icon.primary {
    background: var(--primary-color);
}

.stat-icon.secondary {
    background: var(--secondary-color);
}

.stat-icon.success {
    background: var(--success);
}

.stat-icon.info {
    background: var(--info);
}

.stat-content h3 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
    color: var(--text-dark);
}

.stat-content p {
    margin: 0;
    color: var(--text-brown);
    font-size: 0.9rem;
}

.table {
    font-family: 'Kanit', sans-serif;
}

.table thead th {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-weight: 500;
}

.table tbody tr:hover {
    background: rgba(26, 95, 63, 0.05);
}

.badge {
    font-family: 'Kanit', sans-serif;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
}

.btn {
    font-family: 'Kanit', sans-serif;
    border-radius: 10px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-secondary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background: var(--light-brown);
    border-color: var(--light-brown);
}

/* ===============================================
   Profile Settings Styles
   ===============================================*/

/* Profile Picture Wrapper */
.profile-picture-wrapper {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary-color);
}

.profile-picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-picture-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-picture-placeholder i {
    font-size: 6rem;
    color: var(--white);
}

/* User Avatar in Navbar */
.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-placeholder i {
    font-size: 1.8rem;
    color: var(--white);
}

/* Form Enhancements */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 95, 63, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
}

input[readonly] {
    background-color: var(--light-bg);
    cursor: not-allowed;
}

/* Badge Styles */
.badge {
    font-weight: 400;
    padding: 0.35em 0.65em;
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 280px !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        background: linear-gradient(180deg, var(--primary-color, #3e522d) 0%, var(--primary-hover, #293d1c) 100%) !important;
        background-color: var(--primary-color, #3e522d) !important;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3) !important;
        overflow-y: auto !important;
    }

    .sidebar.show,
    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 15px !important;
    }

    /* Hide the navbar heading / title on mobile */
    .top-navbar h4,
    .top-navbar h3,
    .top-navbar h5,
    .top-navbar .mb-0:not(.user-info) {
        display: none !important;
    }

    /* Style the top-navbar container on mobile */
    .top-navbar {
        padding: 6px 12px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        background-color: var(--bg-card-pure, #ffffff) !important;
        border: 1px solid var(--border-soft-green, rgba(62, 82, 45, 0.08)) !important;
        box-shadow: var(--shadow-soft) !important;
    }

    /* Ensure user details has no layout-breaking properties on mobile */
    .user-info > div {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-end !important; /* Align to right next to the avatar */
    }

    /* Hide user role / subtitle on mobile */
    .user-info .user-role,
    .user-info .user-details span,
    .user-info span {
        display: none !important;
    }

    /* Truncate user name beautifully on mobile */
    .user-info .user-name,
    .user-info .user-details h6 {
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        color: var(--text-dark, #1b2612) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 110px !important;
        margin: 0 !important;
        display: inline-block !important;
        text-align: right !important;
    }

    /* Handle general text in case some files don't use the same classes */
    .user-info h6 {
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        color: var(--text-dark, #1b2612) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 110px !important;
        margin: 0 !important;
        display: inline-block !important;
        text-align: right !important;
    }

    /* Adjust user-info layout on mobile */
    .user-info {
        gap: 6px !important;
        flex-direction: row-reverse !important; /* Put avatar on the far right and name to its left */
    }

    /* Style avatar on mobile */
    .user-avatar, .user-avatar-placeholder {
        width: 32px !important;
        height: 32px !important;
    }
}

@media (max-width: 576px) {
    .login-container {
        margin: 1rem;
    }

    .login-header,
    .login-body {
        padding: 1.5rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
