:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #ffffff;
    --text-muted: #e2e8f0;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --table-header-bg: rgba(255, 255, 255, 0.1);
    --table-row-hover: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism utility */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* --- Login Page --- */
.login-body {
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.login-header h2 {
    margin: 15px 0 5px;
    font-weight: 600;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.icon-large {
    font-size: 3rem;
    color: var(--primary-color);
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 15px 12px 40px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.input-group select {
    padding-left: 15px; /* no icon for selects usually, override below if needed */
}
.input-group select option {
    background: #1e1b4b;
    color: white;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    
    font-weight: 200;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: none;
}

/* --- Dashboard --- */
.dashboard-layout {
    margin: 20px;
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    border-bottom: 1px solid var(--glass-border);
    
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.header-title i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-logout {
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

.btn-logout:hover {
    color: #dc2626;
}

.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filters select, .search-input {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-main);
    outline: none;
}
.filters select option {
    background: #1e1b4b;
}
.search-input {
    width: 200px;
}
.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.btn-icon {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

#btnAddNew {
    width: auto;
    
}

/* --- Table Styles --- */
.table-container {
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

th, td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--glass-border);
}

thead th {
    position: sticky;
    top: 0;
    background: #191b33; /* Solid background for sticky header to prevent overlap visible */
    font-weight: 500;
    z-index: 10;
    color: #a5b4fc;
    cursor: pointer;
}

thead th:hover {
    background: #202342;
}

tbody tr {
    transition: 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background: var(--table-row-hover);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btns button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.2s;
}

.action-btns .btn-edit:hover { color: #3b82f6; }
.action-btns .btn-view:hover { color: #10b981; }

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    padding: 30px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: white;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.form-grid .input-group {
    margin-bottom: 0;
}
.form-grid .input-group input {
    padding-left: 15px;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
}

.form-actions button {
    width: auto;
    padding: 10px 30px;
}

/* View Details Grid */
.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.detail-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.detail-item label {
    display: block;
    font-size: 0.8rem;
    color: #a5b4fc;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* --- Tabs --- */
.tabs-container { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; }
.tab-btn { padding: 10px 20px; background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text-muted); cursor: pointer; transition: 0.3s; font-size: 1rem; font-weight: 500; }
.tab-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.tab-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.module-section { display: none; flex-direction: column; flex-grow: 1; }
.module-section.active { display: flex; }
