:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-color: #333;
    --text-light: #fff;
    --danger-color: #ef4444;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Lao', sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-color);
}

/* Login Page Styles */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.login-container {
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
}

.login-header .logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    /* Ensure logo doesn't stretch */
    margin-bottom: 1rem;
    /* Optional: make it round if it's an icon style */
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
}

.login-header h2 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Fix visibility inside light content area */
.content-area .form-group label {
    color: var(--text-color);
    /* Dark color */
    text-shadow: none;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.alert {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: white;
    font-weight: bold;
}

.alert.error {
    background: rgba(239, 68, 68, 0.8);
}

/* Dashboard & App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    margin: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    color: white;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.logo-area img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links li.active a {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-links .logout {
    color: #ffcccb;
}

.main-content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.top-bar {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.widget {
    padding: 1.5rem;
    color: white;
    text-align: center;
}

.widget i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.widget h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.widget p {
    font-size: 1.5rem;
    font-weight: bold;
}

.content-area {
    flex: 1;
    padding: 2rem;
    background: rgba(255, 245, 245, 0.9);
    color: #333;
    border-radius: 16px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.data-table th {
    background: var(--primary-color);
    color: white;
}

.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: white;
}

.status-badge.active {
    background: #10b981;
}

.status-badge.resigned {
    background: #ef4444;
}

/* Buttons & Utils */
.btn-success {
    background: #10b981;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 4px;
    color: white;
    margin-right: 0.5rem;
    display: inline-block;
}

.btn-icon.edit {
    background: #f59e0b;
}

.btn-icon.delete {
    background: #ef4444;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.full-width {
    grid-column: 1 / -1;
}

.text-warning {
    color: #f59e0b;
    font-size: 0.8rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 6px;
}

/* Tablet Responsiveness (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
        /* Slim sidebar */
    }

    .sidebar {
        align-items: center;
        padding: 1rem 0.5rem;
    }

    .logo-area {
        justify-content: center;
        margin-bottom: 2rem;
    }

    .logo-area h3 {
        display: none;
        /* Hide App Name */
    }

    .logo-area img {
        width: 50px;
        height: 50px;
    }

    .nav-links a {
        justify-content: center;
        padding: 1rem;
    }

    .nav-links a span,
    /* If I had wrapped text in span, but I didn't in HTML. Need to handle text node hiding */
    .nav-links a {
        font-size: 0;
        /* Hide text hack */
    }

    .nav-links a i {
        font-size: 1.5rem;
        /* Larger icons */
        margin: 0;
    }

    .content-area {
        padding: 1.5rem;
    }
}

/* Base Mobile Responsiveness (< 768px) */
@media (max-width: 767.98px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        margin: 0;
        padding: 0.8rem 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background: rgba(102, 126, 234, 0.95);
        /* Solid background for visibility */
        position: sticky;
        top: 0;
        z-index: 1000;
        border-radius: 0 0 16px 16px;
    }

    .logo-area {
        margin-bottom: 0;
        gap: 0.5rem;
    }

    .logo-area h3 {
        font-size: 1.1rem;
        display: block;
        /* Show name on mobile header */
    }

    .nav-links {
        display: none;
        /* Hide standard nav, use a hamburger or bottom bar? 
                          Actually let's keep the existing top-scroll nav but clean it up 
                       */
        display: flex;
        gap: 0.5rem;
    }

    .nav-links li {
        margin: 0;
    }

    /* Mobile Nav Icons Only */
    .nav-links a {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        font-size: 0.7rem;
        /* Tiny text below icon */
        gap: 2px;
        background: transparent;
    }

    .nav-links a:hover,
    .nav-links li.active a {
        background: rgba(255, 255, 255, 0.2);
    }

    .nav-links a i {
        font-size: 1.2rem;
        margin: 0;
        margin-bottom: 2px;
    }

    .nav-links .logout {
        /* On mobile, maybe hide logout or put it at end */
    }

    .main-content {
        padding: 1rem;
        padding-top: 0;
        /* Sidebar is sticky */
    }

    .top-bar {
        padding: 1rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        border: none;
    }

    /* Improve Form Grids on Mobile */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Card/List View for tables on mobile? 
       For now, keep table-scroll but make text smaller */
    .data-table th,
    .data-table td {
        padding: 0.8rem 0.5rem;
        font-size: 0.9rem;
    }

    .login-container {
        width: 95%;
        padding: 1.5rem;
    }
}