/* ==========================================
   SOFT UI DASHBOARD - COMPLETE CSS
   Modern, Mobile-First, Dark Mode Ready
   ========================================== */

/* === ROOT VARIABLES === */
:root {
    /* Colors - Light Mode */
    --primary: #cb0c9f;
    --primary-light: #e91e63;
    --primary-dark: #9c0678;
    --secondary: #8392ab;
    --success: #82d616;
    --danger: #ea0606;
    --warning: #fbcf33;
    --info: #17c1e8;
    --light: #e9ecef;
    --dark: #344767;
    
    /* Backgrounds */
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-topbar: #ffffff;
    
    /* Text Colors */
    --text-primary: #344767;
    --text-secondary: #67748e;
    --text-muted: #8392ab;
    
    /* Borders & Shadows */
    --border-color: #e9ecef;
    --border-radius: 0.75rem;
    --box-shadow: 0 20px 27px 0 rgba(0,0,0,.05);
    --box-shadow-lg: 0 8px 26px -4px rgba(20,20,20,.15), 0 8px 9px -5px rgba(20,20,20,.06);
    
    /* Layout */
    --sidebar-width: 250px;
    --topbar-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
.dark-mode {
    --bg-body: #1a1a1a;
    --bg-card: #1f1f1f;
    --bg-sidebar: #1f1f1f;
    --bg-topbar: #1f1f1f;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #2d2d2d;
    --box-shadow: 0 20px 27px 0 rgba(0,0,0,.3);
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    overflow-x: hidden;
    transition: var(--transition);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* === LAYOUT === */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: 1.5rem;
    min-height: 100vh;
    transition: var(--transition);
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    box-shadow: var(--box-shadow);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    padding: 1.5rem 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h4 svg,
.sidebar-header h4 i {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.sidebar-menu {
    list-style: none;
    padding: 0 0.75rem;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: linear-gradient(310deg, var(--primary), var(--primary-light));
    color: #ffffff;
    box-shadow: var(--box-shadow-lg);
    transform: translateX(2px);
}

.sidebar-menu a svg,
.sidebar-menu a i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* === HAMBURGER MENU === */
.hamburger-menu {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 2000;
    background: var(--bg-card);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: var(--border-radius);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.hamburger-menu span {
    position: relative;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.hamburger-menu span::before,
.hamburger-menu span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.hamburger-menu span::before {
    top: -7px;
}

.hamburger-menu span::after {
    bottom: -7px;
}

.hamburger-menu.active span {
    background: transparent;
}

.hamburger-menu.active span::before {
    top: 0;
    transform: rotate(45deg);
}

.hamburger-menu.active span::after {
    bottom: 0;
    transform: rotate(-45deg);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === TOPBAR === */
.topbar {
    background: var(--bg-topbar);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.topbar h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--primary);
    color: #ffffff;
    transform: scale(1.1);
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(310deg, var(--primary), var(--primary-light));
    color: #ffffff;
    box-shadow: var(--box-shadow-lg);
}

.stat-details h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-details p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* === TABLE === */
.table-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--bg-body);
}

table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

table tbody tr:last-child {
    border-bottom: none;
}

table tbody td {
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(310deg, var(--primary), var(--primary-light));
    color: #ffffff;
    box-shadow: var(--box-shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px -12px rgba(203, 12, 159, 0.4);
}

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* === FORMS === */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(203, 12, 159, 0.1);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    line-height: 1;
}

.badge-success {
    background-color: rgba(130, 214, 22, 0.2);
    color: var(--success);
}

.badge-danger {
    background-color: rgba(234, 6, 6, 0.2);
    color: var(--danger);
}

.badge-warning {
    background-color: rgba(251, 207, 51, 0.2);
    color: #f57c00;
}

.badge-info {
    background-color: rgba(23, 193, 232, 0.2);
    color: var(--info);
}

/* === MOBILE BOTTOM NAV === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    padding: 0.5rem;
}

.bottom-nav-menu {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.bottom-nav-menu li {
    flex: 1;
}

.bottom-nav-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    transition: var(--transition);
}

.bottom-nav-menu a.active {
    color: var(--primary);
}

.bottom-nav-menu a svg,
.bottom-nav-menu a i {
    width: 24px;
    height: 24px;
}

/* === ATTENDANCE SUMMARY === */
.attendance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.attendance-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.attendance-item h4 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.attendance-item p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.attendance-item .label {
    font-weight: 700;
    color: var(--primary);
}

/* === FILTER SECTION === */
.filter-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

/* === RESPONSIVE DESIGN === */

/* Tablet */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Mobile */
@media (max-width: 768px) {
    .topbar {
        margin-top: 4rem;
        padding: 1rem;
    }
    
    .topbar h2 {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 1rem;
        padding-bottom: 5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .bottom-nav {
        display: block;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .card {
        padding: 1rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    table thead th,
    table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .attendance-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === PRINT STYLES === */
@media print {
    .sidebar,
    .hamburger-menu,
    .bottom-nav,
    .topbar-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}