/* =========================================================
   🎨 DOS Brand Design System (Gradient Theme + Fixed Layouts)
   ========================================================= */
:root {
    /* --- DOS BRAND COLORS --- */
    --brand-blue: #0078D7;       /* DOS Logo Primary Blue */
    --brand-dark: #121212;       /* DOS Logo Black */
    --dashboard-blue-dark: #0B63A8; /* Darker blue from dashboard */
    
    /* --- THEME GRADIENTS --- */
    --bg-gradient-light: linear-gradient(135deg, #E6F0F8 0%, var(--dashboard-blue-dark) 100%);
    --bg-gradient-dark: linear-gradient(135deg, #0b1220 0%, #071a2d 100%);

    /* Functional Palette */
    --primary-color: var(--brand-blue);
    --primary-hover: #005a9e;    
    --secondary-color: #767676;
    
    /* Semantic */
    --success-color: #107c10;
    --danger-color: #d13438;
    --warning-color: #ffb900;
    
    /* LIGHT MODE DEFAULTS */
    --bg-current: var(--bg-gradient-light);
    
    /* Glass Effect Card Background */
    --card-bg: rgba(255, 255, 255, 0.92); 
    --card-border: 1px solid rgba(255, 255, 255, 0.6);
    
    /* HEADER: DOS Logo Blue */
    --header-bg: var(--brand-blue);
    --header-text: #ffffff;
    
    /* Text */
    --text-main: #201f1e;
    --text-muted: #605e5c;
    --border-color: #e1dfdd;
    
    /* UI Dimensions */
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.1);
    --input-height: 42px;
}

/* 🌙 DARK MODE */
body.dark-mode {
    --bg-current: var(--bg-gradient-dark);
    --card-bg: rgba(30, 30, 35, 0.85); /* Dark Glass */
    --card-border: 1px solid rgba(255, 255, 255, 0.08);
    
    /* Header blends with dark theme */
    --header-bg: rgba(30, 30, 35, 0.95);
    --header-text: #ffffff;
    
    --text-main: #f3f3f3;
    --text-muted: #a19f9d;
    --border-color: #444;
    --primary-hover: #4ba6ff;
}

/* =========================================================
   📦 Layout & Typography
   ========================================================= */
body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-current);
    background-attachment: fixed; /* Keeps gradient fixed */
    background-size: cover;
    color: var(--text-main);
    margin: 0;
    padding-bottom: 60px;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- HEADER --- */
.dashboard-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-area h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white !important;
}

.btn-header {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-header:hover {
    background: #fff;
    color: var(--brand-blue);
}

/* --- INFO BAR --- */
.info-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.info-pill {
    background: var(--card-bg);
    border: var(--card-border);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
}

/* --- MAIN CARD (Glassmorphism) --- */
.modern-card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.02);
}

.card-body-custom {
    padding: 1.5rem;
}

/* =========================================================
   📝 Form Layout & Inputs (FIXED)
   ========================================================= */

/* CSS Grid for Side-by-Side Inputs */
.form-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Forces 2 columns */
    gap: 20px;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .form-grid-container { grid-template-columns: 1fr; } /* Stack on mobile */
}

/* Standard Input Style */
.form-control {
    display: block;
    width: 100%;
    height: var(--input-height);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.7); /* Slight transparency */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
    box-sizing: border-box; /* Fixes width calculation */
}

.dark-mode .form-control { background-color: rgba(0, 0, 0, 0.2); }

.form-control:focus {
    background-color: #fff;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.15);
    outline: none;
}

.dark-mode .form-control:focus { background-color: #2a2a2a; }

/* Labels */
.form-label {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
}

/* Input Group (for Password Eye) */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}
.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group .btn-reveal {
    height: var(--input-height);
    padding: 0 1rem;
    border: 1px solid var(--border-color);
    border-left: none;
    background: rgba(0,0,0,0.02);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}
.input-group .btn-reveal:hover { background: rgba(0,0,0,0.05); color: var(--brand-blue); }

/* --- Search Bar Specific (Header) --- */
.search-wrapper { position: relative; width: 300px; max-width: 100%; }
.search-wrapper i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
}
.form-control-search {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.5);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}
.form-control-search:focus {
    border-color: var(--brand-blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.15);
}

/* =========================================================
   🔘 Buttons & Interactive
   ========================================================= */
.btn-primary-custom {
    background-color: var(--brand-blue);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 120, 215, 0.2);
    border: none;
    cursor: pointer;
}
.btn-primary-custom:hover { 
    background-color: var(--primary-hover); 
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 120, 215, 0.3);
}

/* Avatar */
.avatar-circle {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--brand-blue), #005a9e);
    box-shadow: 0 4px 10px rgba(0, 120, 215, 0.3);
    border: 2px solid rgba(255,255,255,0.2);
}

/* =========================================================
   ✅ Fixed Role Grid (Responsive Chips)
   ========================================================= */
.role-grid {
    display: grid;
    /* Min 160px width keeps chips from getting too small or too wide */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.role-chip {
    display: block;
    cursor: pointer;
    position: relative;
    width: 100%;
}

.role-chip input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-card-visual {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    overflow: hidden;
}

/* Hover & Selected States */
.role-chip:hover .role-card-visual {
    border-color: var(--brand-blue);
    background: rgba(0, 120, 215, 0.04);
}

.role-chip input[type="radio"]:checked + .role-card-visual {
    border-color: var(--brand-blue);
    background: rgba(0, 120, 215, 0.08);
    box-shadow: inset 0 0 0 1px var(--brand-blue);
}

.role-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.role-chip input[type="radio"]:checked + .role-card-visual .role-icon {
    background: var(--brand-blue);
    color: white;
}

.role-name { 
    font-weight: 600; 
    color: var(--text-main); 
    font-size: 0.85rem; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Footer Actions --- */
.form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    align-items: center;
}
.btn-cancel {
    text-decoration: none; 
    color: var(--text-muted); 
    font-weight: 600; 
    font-size: 0.9rem;
    transition: 0.2s;
}
.btn-cancel:hover { color: var(--text-main); }

/* --- Table Styles --- */
.custom-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.custom-table th {
    text-align: left; padding: 1rem 1.5rem; color: var(--text-muted);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color); font-weight: 700;
    background: rgba(0,0,0,0.02);
}
.custom-table td { padding: 1rem 1.5rem; vertical-align: middle; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.custom-table tbody tr:hover { background-color: rgba(0, 120, 215, 0.04); }

.btn-action {
    background: transparent; border: 1px solid transparent; color: var(--text-muted);
    width: 32px; height: 32px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s; cursor: pointer; text-decoration: none;
}
.btn-action:hover { background: rgba(0,0,0,0.05); color: var(--brand-blue); }
.btn-action.delete:hover { background: #fff1f0; color: var(--danger-color); }