/*
 * Portal Invoice & Tenant - Grand Batam Mall
 * Modern, Professional, Elegant Design with Dark Mode Support
 * Version: 2.0
 */

/* =====================================================
   CSS VARIABLES - Light & Dark Mode
   ===================================================== */

:root {
    /* Material Design Colors - Light Mode */
    --primary-color: #1976D2;
    --primary-dark: #1565C0;
    --primary-light: #42A5F5;
    --secondary-color: #00897B;
    --accent-color: #FF6F00;
    --danger-color: #D32F2F;
    --warning-color: #F57C00;
    --info-color: #0288D1;
    --success-color: #388E3C;

    /* Background Colors - Material */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFAFA;
    --bg-tertiary: #F5F5F5;
    --bg-elevated: #FFFFFF;

    /* Text Colors - Material */
    --text-primary: rgba(0, 0, 0, 0.87);
    --text-secondary: rgba(0, 0, 0, 0.60);
    --text-tertiary: rgba(0, 0, 0, 0.38);
    --text-inverse: #FFFFFF;

    /* Border Colors */
    --border-color: rgba(0, 0, 0, 0.12);
    --border-dark: rgba(0, 0, 0, 0.24);

    /* Material Design Elevation Shadows */
    --shadow-0: none;
    --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --shadow-4: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
    --shadow-5: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);

    /* Sidebar - Material */
    --sidebar-bg: linear-gradient(180deg, #1565C0 0%, #0D47A1 100%);
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-hover: #FFFFFF;
    --sidebar-active: rgba(255, 255, 255, 0.12);

    /* Material Motion */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 375ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius - Material */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;

    /* Spacing - Material (8dp grid) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* Dark Mode Variables - Material */
[data-theme="dark"] {
    --primary-color: #42A5F5;
    --primary-dark: #1976D2;
    --primary-light: #64B5F6;

    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2C2C2C;
    --bg-elevated: #1E1E1E;

    --text-primary: rgba(255, 255, 255, 0.87);
    --text-secondary: rgba(255, 255, 255, 0.60);
    --text-tertiary: rgba(255, 255, 255, 0.38);
    --text-inverse: rgba(0, 0, 0, 0.87);

    --border-color: rgba(255, 255, 255, 0.12);
    --border-dark: rgba(255, 255, 255, 0.24);

    /* Dark mode elevations */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.5);
    --shadow-2: 0 3px 6px rgba(0,0,0,0.5), 0 3px 6px rgba(0,0,0,0.6);
    --shadow-3: 0 10px 20px rgba(0,0,0,0.6), 0 6px 6px rgba(0,0,0,0.7);
    --shadow-4: 0 14px 28px rgba(0,0,0,0.7), 0 10px 10px rgba(0,0,0,0.8);
    --shadow-5: 0 19px 38px rgba(0,0,0,0.8), 0 15px 12px rgba(0,0,0,0.9);

    --sidebar-bg: linear-gradient(180deg, #1E1E1E 0%, #121212 100%);
    --sidebar-text: rgba(255, 255, 255, 0.6);
    --sidebar-text-hover: rgba(255, 255, 255, 0.87);
}

/* =====================================================
   GLOBAL STYLES
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

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 {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

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

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

/* =====================================================
   CARDS
   ===================================================== */

.card {
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
}

/* Stat Cards - Material Design */
.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-2);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

/* Material Color Variants */
.stat-card.primary {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #F57C00 0%, #E64A19 100%);
}

.stat-card.danger {
    background: linear-gradient(135deg, #D32F2F 0%, #C62828 100%);
}

.stat-card.info {
    background: linear-gradient(135deg, #0288D1 0%, #0277BD 100%);
}

.stat-card.secondary {
    background: linear-gradient(135deg, #00897B 0%, #00796B 100%);
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 24px;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.75;
    letter-spacing: 0.02857em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    min-width: 64px;
}

/* Material Ripple Effect */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
    pointer-events: none;
}

.btn:active::after {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

/* Material Raised Button */
.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-3);
}

.btn-primary:active {
    box-shadow: var(--shadow-4);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-success:hover {
    background: #2E7D32;
    box-shadow: var(--shadow-3);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-warning:hover {
    background: #E64A19;
    box-shadow: var(--shadow-3);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-danger:hover {
    background: #C62828;
    box-shadow: var(--shadow-3);
}

.btn-info {
    background: var(--info-color);
    color: white;
    box-shadow: var(--shadow-2);
}

.btn-info:hover {
    background: #0277BD;
    box-shadow: var(--shadow-3);
}

/* Material Outlined Button */
.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-dark);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(25, 118, 210, 0.04);
    border-color: var(--primary-color);
}

/* Material Text Button */
.btn-link {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
    padding: 8px 16px;
}

.btn-link:hover {
    background: rgba(25, 118, 210, 0.04);
}

/* Button Sizes */
.btn-sm {
    padding: 6px 16px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 0.9375rem;
}

/* Icon Button */
.btn-icon {
    min-width: auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-icon.btn-lg {
    width: 56px;
    height: 56px;
}

/* =====================================================
   FORMS
   ===================================================== */

/* Material Text Field */
.form-control {
    width: 100%;
    padding: 16px 12px;
    font-size: 1rem;
    line-height: 1.5;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-bottom: 2px solid var(--primary-color);
    background: transparent;
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

/* Material Outlined Variant */
.form-control-outlined {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.form-control-outlined:focus {
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-sm);
}

/* Material Filled Variant */
.form-control-filled {
    background: var(--bg-tertiary);
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 20px 12px 6px;
}

.form-control-filled:focus {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--primary-color);
}

.form-group {
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

/* Floating Label */
.form-group-floating {
    position: relative;
}

.form-group-floating label {
    position: absolute;
    left: 12px;
    top: 16px;
    font-size: 1rem;
    pointer-events: none;
    transform-origin: left top;
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.form-group-floating .form-control:focus + label,
.form-group-floating .form-control:not(:placeholder-shown) + label {
    transform: translateY(-20px) scale(0.75);
    color: var(--primary-color);
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
}

.input-group-text {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group-prepend .input-group-text {
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-append .input-group-text {
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group .form-control {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group-prepend + .form-control {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* =====================================================
   TABLES
   ===================================================== */

.table {
    width: 100%;
    margin-bottom: var(--spacing-lg);
    background: var(--bg-elevated);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table thead th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

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

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

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--bg-secondary);
}

/* =====================================================
   BADGES
   ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* =====================================================
   ALERTS
   ===================================================== */

.alert {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid;
    display: flex;
    align-items: start;
    gap: var(--spacing-md);
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--info-color);
    color: var(--info-color);
}

/* =====================================================
   SIDEBAR - Material Design
   ===================================================== */

.sidebar {
    background: var(--sidebar-bg);
    min-height: 100vh;
    width: 280px;
    position: fixed;
    left: 0;
    top: 0;
    padding: 0;
    box-shadow: var(--shadow-3);
    transition: transform var(--transition-normal);
    z-index: 1000;
    overflow-y: auto;
}

/* Sidebar Header */
.sidebar-header {
    padding: var(--spacing-lg);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: var(--spacing-md);
}

.sidebar-logo {
    width: 100%;
    height: auto;
    margin: 0 auto var(--spacing-md);
    background: white;
    border-radius: 5%;
    padding: 12px;
    box-shadow: var(--shadow-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs);
    letter-spacing: 0.5px;
}

.sidebar-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Sidebar Navigation */
.sidebar-nav {
    list-style: none;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
}

.sidebar-nav .nav-item {
    margin-bottom: 4px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px var(--spacing-md);
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.9375rem;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

/* Material Ripple on Nav Link */
.sidebar-nav .nav-link::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
    pointer-events: none;
}

.sidebar-nav .nav-link:active::after {
    width: 200px;
    height: 200px;
    transition: width 0s, height 0s;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-hover);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-hover);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-link span {
    flex: 1;
}

/* =====================================================
   NAVBAR
   ===================================================== */

.navbar-top {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-lg) var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

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

/* Tenant Navbar (Bootstrap override) */
.navbar-dark {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%) !important;
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md) 0;
}

.navbar-dark .navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

.navbar-dark .navbar-brand:hover {
    transform: translateY(-2px);
}

.navbar-dark .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin: 0 var(--spacing-xs);
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white !important;
}

.navbar-dark .dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-sm);
}

/* Hamburger Menu Button (for mobile sidebar) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--spacing-md);
    left: var(--spacing-md);
    z-index: 10000;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

/* =====================================================
   DARK MODE TOGGLE
   ===================================================== */

.dark-mode-toggle {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    z-index: 9999;
    background: var(--primary-color);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all var(--transition-normal);
}

.dark-mode-toggle:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.5);
}

/* =====================================================
   MODAL
   ===================================================== */

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--spacing-lg);
}

.modal-title {
    color: var(--text-primary);
    font-weight: 700;
}

.modal-body {
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.modal-footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: var(--spacing-lg);
}

/* =====================================================
   UTILITIES
   ===================================================== */

.content-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--bg-secondary);
    transition: margin-left var(--transition-normal);
}

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-tertiary) !important; }

.bg-primary { background: var(--bg-primary) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Content Wrapper - Default Desktop with Sticky Footer */
.content-wrapper {
    margin-left: 280px;
    min-height: 100vh;
    width: calc(100% - 280px);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

/* Navbar stays at top */
.content-wrapper .navbar-top {
    flex-shrink: 0;
}

/* Main content grows to fill space */
.content-wrapper .container-fluid {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Footer always at bottom */
.content-wrapper footer {
    margin-top: auto !important;
    flex-shrink: 0;
}

/* Tablet and Below (≤ 1024px) */
@media (max-width: 1024px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }

    .card-body {
        padding: var(--spacing-md);
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile and Small Tablets (≤ 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

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

    /* Show hamburger menu button */
    .sidebar-toggle {
        display: block;
    }

    /* Sidebar - Hidden by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
        box-shadow: var(--shadow-xl);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar.active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        width: calc(100vw - 280px);
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
        padding-top: 60px; /* Space for hamburger button */
        /* Keep flexbox for sticky footer on mobile */
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .container-fluid {
        padding: var(--spacing-md) !important;
        /* Keep flex for content area on mobile */
        flex: 1 0 auto;
    }

    /* Navbar - Mobile friendly */
    .navbar-top {
        padding: var(--spacing-md);
    }

    .navbar-top h5 {
        font-size: 1rem;
    }

    /* Cards - Mobile spacing */
    .card {
        margin-bottom: var(--spacing-md);
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .card-header,
    .card-footer {
        padding: var(--spacing-md);
    }

    /* Buttons - Mobile friendly */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

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

    /* Tables - Scrollable */
    .table-responsive {
        margin: 0 calc(-1 * var(--spacing-md));
        width: calc(100% + 2 * var(--spacing-md));
    }

    .table {
        font-size: 0.8125rem;
    }

    .table td,
    .table th {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Forms - Mobile optimized */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    /* Stats Cards - Stack on mobile */
    .row [class*="col-"] {
        margin-bottom: var(--spacing-md);
    }

    /* Dark Mode Toggle - Smaller on mobile */
    .dark-mode-toggle {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        width: 48px;
        height: 48px;
        font-size: 1.125rem;
    }

    /* Dropdown menus - Better mobile UX */
    .dropdown-menu {
        min-width: 200px;
        font-size: 0.875rem;
    }

    /* Badges and Pills */
    .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.5em;
    }

    /* Alerts - Mobile spacing */
    .alert {
        font-size: 0.875rem;
        padding: var(--spacing-md);
    }
}

/* Extra Small Mobile (≤ 480px) */
@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }

    .container-fluid {
        padding: var(--spacing-sm) !important;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }

    .stat-card {
        margin-bottom: var(--spacing-sm);
    }

    .navbar-top h5 {
        font-size: 0.875rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: var(--spacing-xs);
        border-radius: var(--radius-md) !important;
    }
}

/* Large Desktop (≥ 1440px) */
@media (min-width: 1440px) {
    .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   DATATABLES CUSTOM
   ===================================================== */

.dataTables_wrapper {
    padding: 0;
}

.dataTables_filter input {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dataTables_length select {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dataTables_info,
.dataTables_paginate {
    color: var(--text-secondary) !important;
}

.paginate_button {
    border-radius: var(--radius-md) !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}
