:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --header-height: 64px;
    --white: #ffffff;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--text-color);
}

/* Login Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-logo {
    height: 80px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.login-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-size: 1.5rem;
}

.login-header p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#login-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#login-btn:hover {
    background-color: var(--primary-hover);
}

#login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.message {
    margin-top: 1rem;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.message.error {
    color: #dc2626;
}

.message.success {
    color: #059669;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
    position: relative;
    z-index: 20;
    height: 100%;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.sidebar-logo {
    height: 40px;
    margin-right: 0.75rem;
    object-fit: contain;
}

.app-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-link i {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    min-width: 20px;
}

.nav-link.logout {
    color: #dc2626;
}

.nav-link.logout:hover {
    background-color: #fef2f2;
    border-left-color: #dc2626;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    transition: margin-left var(--transition-speed);
}

.top-header {
    height: var(--header-height);
    background-color: var(--white);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.header-left {
    display: flex;
    align-items: center;
}

#sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 1rem;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

#sidebar-toggle:hover {
    background-color: #f3f4f6;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
}

.badge {
    background-color: #e0e7ff;
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.content-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--bg-color);
}

.welcome-card {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Sidebar Overlay (Global) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width);
    }

    .top-header {
        padding: 0 1rem;
    }

    .content-container {
        padding: 1rem;
    }
}

/* Modern Button Styles (Global) */
.btn {
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: white !important; /* Ensure text is white */
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-modern i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}
.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}
.btn-info:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}
/* Force hide overlay on desktop */
@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-responsive table {
    width: 100%;
    white-space: nowrap;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .header-left h2 {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 0.5rem;
    }
}
