/* ==============================================================
   TABLE OF CONTENTS
   1. Root Variables & Reset
   2. Typography & Basics
   3. Auth Components (Login)
   4. Layout (Wrapper, Sidebar, Topbar, Footer)
   5. General Components (Cards, Buttons, Forms, Alerts, Badges)
   6. Data Tables
   ============================================================== */

/* 1. ROOT VARIABLES & RESET */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --secondary-color: #f8f9fa;
    --text-color: #333333;
    --text-muted: #6c757d;
    --bg-color: #eef2f5;
    --sidebar-bg: #1a233a;
    --sidebar-text: #c2c7d0;
    --sidebar-hover: #ffffff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --border-color: #dee2e6;
    --border-radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 2. TYPOGRAPHY & BASICS */
body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* 3. AUTH COMPONENTS (LOGIN) */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--bg-color);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 15px;
}

.auth-card {
    background: #fff;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 25px;
}

.auth-header h2 {
    color: var(--primary-color);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* 4. LAYOUT (WRAPPER, SIDEBAR, TOPBAR, FOOTER) */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.sidebar.collapsed {
    margin-left: -250px;
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.tenant-name {
    font-size: 12px;
    color: var(--sidebar-text);
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
}

.sidebar-menu li.menu-header {
    padding: 10px 20px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: var(--sidebar-text);
    transition: 0.2s;
}

.sidebar-menu li a:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--sidebar-hover);
    border-left: 3px solid var(--primary-color);
}

/* Main Content & Topbar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px);
}

.topbar {
    background-color: #fff;
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
    color: var(--text-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
}

.content-body {
    padding: 20px;
    flex: 1;
}

/* Footer */
.main-footer {
    background-color: #fff;
    padding: 15px 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* 5. GENERAL COMPONENTS */
.card {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-success { background-color: var(--success-color); color: #fff; }
.btn-danger { background-color: var(--danger-color); color: #fff; }

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.col-md-6, .col-md-4, .col-md-3, .col-md-2 {
    padding-right: 10px;
    padding-left: 10px;
}

.col-md-6 { width: 50%; }
.col-md-4 { width: 33.333%; }
.col-md-3 { width: 25%; }
.col-md-2 { width: 16.666%; }

/* Alerts & Badges */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }

.badge {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 12px;
    color: #fff;
}
.badge-primary { background-color: var(--primary-color); }
.badge-success { background-color: var(--success-color); }
.badge-danger { background-color: var(--danger-color); }

/* 6. DATA TABLES */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table th, .table td {
    padding: 12px 15px;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table th {
    background-color: var(--secondary-color);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}