/* ========================================
   TopUp Agent System - Main Styles
   ======================================== */

/* CSS Variables */
:root {
    /* Colors */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #6366f1;
    
    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    
    /* Typography - System font stack for fast loading */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

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

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

/* Base Form Elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-900);
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

/* Better Select Styling */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select::-ms-expand {
    display: none;
}

select option {
    padding: 0.5rem;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Mobile Overlay
   ======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.sidebar-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

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

.sidebar-collapse-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.sidebar-collapse-btn i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    max-width: calc(100% - 50px);
    flex-shrink: 1;
}

.logo-image {
    display: block;
    height: 36px !important;
    width: auto !important;
    max-width: 140px !important;
    max-height: 36px !important;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

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

.sidebar-close-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Sidebar Search */
.sidebar-search {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    transition: color 0.2s;
}

/* Higher specificity to override base input[type="text"] styles */
input.search-input,
.sidebar-search input.search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 2.75rem;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px;
    color: white !important;
    -webkit-text-fill-color: white !important;
    font-size: 0.875rem;
    transition: all 0.2s;
}

input.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Override browser autofill styling */
input.search-input:-webkit-autofill,
input.search-input:-webkit-autofill:hover,
input.search-input:-webkit-autofill:focus,
input.search-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.08) inset !important;
    -webkit-text-fill-color: white !important;
    caret-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

input.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    -webkit-text-fill-color: white !important;
    caret-color: white !important;
}

input.search-input:not(:focus):focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.6);
    outline-offset: 2px;
}

input.search-input:focus + .search-icon,
.sidebar-search:focus-within .search-icon {
    color: rgba(255, 255, 255, 0.6);
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.search-clear-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.search-input:not(:placeholder-shown) ~ .search-clear-btn {
    display: flex;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

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

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    margin: 0.125rem 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 10px;
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 0 4px 4px 0;
}

.nav-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.12);
}

.nav-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
    opacity: 0.9;
}

.nav-link span {
    flex: 1;
}

.nav-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.1);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.user-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-color: rgba(255, 255, 255, 0.12);
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9375rem;
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-role {
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-transform: capitalize;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.user-actions {
    display: flex;
    gap: 0.375rem;
    margin-left: auto;
    flex-shrink: 0;
}

.user-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.user-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.user-action-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.user-action-btn.logout:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.user-action-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 1px;
}

/* ========================================
   Sidebar Collapsed State
   ======================================== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-search {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0.875rem;
}

.sidebar.collapsed .logo {
    max-width: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem 0;
    margin: 0.125rem auto;
    width: 44px;
}

.sidebar.collapsed .nav-link i {
    font-size: 1.125rem;
}

.sidebar.collapsed .user-card {
    padding: 0.5rem 0;
    justify-content: center;
    background: transparent;
    border: none;
    gap: 0;
}

.sidebar.collapsed .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
    border-radius: 8px;
}

.sidebar.collapsed .user-actions {
    display: none;
}


/* Adjust main content margin for collapsed sidebar */
body:not(.sidebar-open) .main-content {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body:not(.sidebar-open) .sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ========================================
   Search Filter Styles
   ======================================== */
.nav-section.search-hidden {
    display: none;
}

.nav-link.search-hidden {
    display: none;
}

.search-highlight {
    color: #fbbf24;
    font-weight: 600;
}

.no-search-results {
    padding: 2rem 1.25rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
    display: none;
}

.no-search-results.show {
    display: block;
}

.no-search-results i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Content Header */
.content-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.mobile-menu-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Content Body */
.content-body {
    flex: 1;
    padding: 2rem;
}

/* ========================================
   Messages / Alerts
   ======================================== */
.messages {
    padding: 1rem 2rem 0;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert i {
    font-size: 1.125rem;
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

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

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

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

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

.stat-icon.info {
    background: rgba(99, 102, 241, 0.1);
    color: var(--info);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* ========================================
   Tables
   ======================================== */
.table-container {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table td {
    font-size: 0.9375rem;
}

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

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

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.form-input,
.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-900);
    transition: all 0.2s;
}

.form-input:focus,
.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder,
.form-control::placeholder {
    color: var(--gray-400);
}

.form-input.error,
.form-control.error {
    border-color: var(--danger);
}

.form-help {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.5rem;
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}

.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
}

/* ========================================
   Status Badges
   ======================================== */
.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

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

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

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

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

.badge-info {
    background: rgba(99, 102, 241, 0.1);
    color: var(--info);
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.pagination a {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.pagination a:hover {
    background: var(--gray-100);
}

.pagination .current {
    background: var(--primary);
    color: white;
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

@media (max-width: 576px) {
    .auth-container {
        padding: 0;
        background: white;
        align-items: stretch;
    }
}

.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.auth-logo i {
    color: var(--primary);
    font-size: 2rem;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--gray-400);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

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

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

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.hidden { display: none !important; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    }

    /* Disable collapsed state on mobile - always use full sidebar */
    .sidebar.collapsed {
        width: var(--sidebar-width);
    }

    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .nav-badge,
    .sidebar.collapsed .user-details,
    .sidebar.collapsed .sidebar-search {
        display: flex;
    }

    .sidebar.collapsed .sidebar-header {
        justify-content: space-between;
        padding: 1.25rem 1.25rem;
    }

    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
        padding: 0.75rem 1.25rem;
        margin: 0.125rem 0.75rem;
        width: auto;
    }

    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide collapse button on mobile */
    .sidebar-collapse-btn {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-header {
        padding: 0 1rem;
    }

    .content-body {
        padding: 1rem;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }
    
    .logo-image {
        height: 32px !important;
        max-width: 120px !important;
        max-height: 32px !important;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.875rem 1rem;
        margin: 0.125rem 0.5rem;
        font-size: 0.95rem;
    }
    
    .nav-section-title {
        padding: 0.75rem 1rem 0.5rem;
    }
    
    .sidebar-footer {
        padding: 0.875rem 1rem;
    }
    
    .user-card {
        padding: 0.625rem;
    }
    
    .user-avatar {
        width: 38px;
        height: 38px;
    }
    
    .user-action-btn {
        width: 36px;
        height: 36px;
    }
    
    .content-header {
        padding: 0 0.75rem;
        height: 56px;
    }
    
    .page-title {
        font-size: 1.125rem;
    }
    
    .content-body {
        padding: 0.75rem;
    }
    
    .messages {
        padding: 0.75rem 0.75rem 0;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 1rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .header-right .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .header-right .btn span {
        display: none;
    }
}

/* ========================================
   Order Detail Specific
   ======================================== */
.order-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .order-detail-grid {
        grid-template-columns: 1fr;
    }
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.info-value {
    font-weight: 600;
    color: var(--gray-900);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.625rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.timeline-item.success::before {
    background: var(--success);
}

.timeline-item.danger::before {
    background: var(--danger);
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.timeline-content {
    font-weight: 500;
}

.timeline-note {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Payment proof image */
.payment-proof-preview {
    max-width: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

/* ========================================
   Modals
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========================================
   Additional Utilities
   ======================================== */
hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 1.5rem 0;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Price Display (Order Form)
   ======================================== */
.price-display {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.price-display.visible {
    display: block;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.price-row:not(:last-child) {
    border-bottom: 1px dashed var(--gray-200);
}

.price-row.total {
    border-top: 2px solid var(--gray-300);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-weight: 600;
}

.price-row .price-label {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.price-row .price-value {
    color: var(--gray-900);
    font-weight: 500;
}

.price-row.total .price-value {
    color: var(--primary);
    font-size: 1.125rem;
    font-weight: 700;
}

/* Quantity Input Styling */
#quantity-group input[type="number"] {
    font-size: 1.125rem;
    font-weight: 500;
    text-align: center;
}
