/**
 * Main Stylesheet
 * API Room Management Dashboard
 */

/* ================================================
   CSS Variables
   ================================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-light: #f8fafc;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dark: #1e293b;
    
    --sidebar-width: 260px;
    --topnav-height: 70px;
    
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 12px;
    --radius-sm: 8px;
}

/* ================================================
   Base Styles
   ================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary);
}

a:hover {
    color: var(--primary-dark);
}

/* ================================================
   Auth Pages
   ================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e3a5f 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-card {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-logo i {
    font-size: 32px;
    color: white;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--secondary);
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: block;
}

.auth-form .form-control {
    height: 48px;
    border-radius: var(--radius-sm);
    border: 2px solid #e2e8f0;
    padding: 10px 15px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.auth-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-form .input-group-text {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-right: none;
    color: var(--secondary);
}

.auth-form .input-group .form-control {
    border-left: none;
}

.auth-form .input-group:focus-within .input-group-text {
    border-color: var(--primary);
}

.auth-form .btn-primary {
    height: 50px;
    font-weight: 600;
    font-size: 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}

.auth-footer p {
    color: var(--secondary);
    font-size: 14px;
}

.auth-footer a {
    font-weight: 600;
}

.auth-features {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.auth-features .feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--secondary);
}

.auth-features .feature i {
    color: var(--primary);
}

.auth-divider {
    text-align: center;
    margin: 25px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    position: relative;
    color: var(--secondary);
    font-size: 13px;
}

.quick-info {
    display: flex;
    justify-content: center;
    gap: 25px;
}

.quick-info .info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--secondary);
}

.quick-info .info-item i {
    font-size: 18px;
}

/* ================================================
   Dashboard Layout
   ================================================ */
.dashboard-page {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-dark);
    color: var(--text-primary);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.sidebar-header .logo i {
    color: var(--primary-light);
    font-size: 24px;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar i {
    font-size: 20px;
    color: white;
}

.user-avatar.admin {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.user-info h6 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-info .badge {
    font-size: 10px;
    padding: 3px 8px;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu .menu-header {
    padding: 15px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
}

.sidebar-menu li a .badge {
    margin-left: auto;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.balance-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.balance-box small {
    color: var(--text-secondary);
    font-size: 12px;
}

.balance-box h5 {
    color: var(--success);
    font-size: 18px;
    margin: 5px 0 0;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Navbar */
.top-navbar {
    height: var(--topnav-height);
    background: white;
    padding: 0 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.navbar-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

.navbar-search input {
    width: 100%;
    height: 42px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    padding: 0 15px 0 45px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.navbar-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.navbar-title h6 {
    color: var(--secondary);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    color: var(--success);
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
}

.balance-display i {
    font-size: 16px;
}

/* Content Wrapper */
.content-wrapper {
    padding: 25px;
    flex: 1;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.page-header p {
    color: var(--secondary);
    font-size: 14px;
}

/* ================================================
   Stat Cards
   ================================================ */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.balance::before { background: var(--primary); }
.stat-card.requests::before { background: var(--info); }
.stat-card.spent::before,
.stat-card.revenue::before { background: var(--success); }
.stat-card.api::before { background: var(--warning); }
.stat-card.users::before { background: var(--info); }
.stat-card.pending::before { background: var(--warning); }
.stat-card.deposits::before { background: var(--success); }
.stat-card.bonus::before { background: var(--warning); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--danger); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card.balance .stat-icon { background: #eef2ff; color: var(--primary); }
.stat-card.requests .stat-icon { background: #dbeafe; color: var(--info); }
.stat-card.spent .stat-icon,
.stat-card.revenue .stat-icon { background: #dcfce7; color: var(--success); }
.stat-card.api .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card.users .stat-icon { background: #dbeafe; color: var(--info); }
.stat-card.pending .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card.deposits .stat-icon { background: #dcfce7; color: var(--success); }
.stat-card.bonus .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-card.success .stat-icon { background: #dcfce7; color: var(--success); }
.stat-card.danger .stat-icon { background: #fee2e2; color: var(--danger); }

.stat-content h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.stat-content p {
    font-size: 13px;
    color: var(--secondary);
    margin: 0;
}

.stat-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 11px;
    color: var(--secondary);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 15px;
}

.stat-action {
    position: absolute;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.stat-action:hover {
    text-decoration: underline;
}

/* ================================================
   Cards
   ================================================ */
.card {
    background: white;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 18px 20px;
    font-weight: 600;
}

.card-header h5 {
    margin: 0;
    font-size: 16px;
    color: var(--text-dark);
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 15px 20px;
}

/* ================================================
   Tables
   ================================================ */
.table {
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    padding: 12px 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.service-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.service-badge.ludo_room { background: #dbeafe; color: #1d4ed8; }
.service-badge.auto_ludo_room { background: #dcfce7; color: #16a34a; }
.service-badge.ludo_advance_room { background: #fef3c7; color: #d97706; }

/* ================================================
   Pricing List
   ================================================ */
.pricing-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pricing-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}

.pricing-list li:last-child {
    border-bottom: none;
}

.pricing-info {
    display: flex;
    flex-direction: column;
}

.pricing-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.pricing-info small {
    font-size: 12px;
}

.pricing-amount {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.pricing-note {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
    color: var(--secondary);
}

/* ================================================
   Pricing Cards (Admin)
   ================================================ */
.pricing-card {
    transition: transform 0.2s;
}

.pricing-card:hover {
    transform: translateY(-5px);
}

.pricing-card.inactive {
    opacity: 0.6;
}

.pricing-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ================================================
   Gradient Backgrounds
   ================================================ */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

/* ================================================
   Forms
   ================================================ */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 2px solid #e2e8f0;
    padding: 10px 15px;
    transition: border-color 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

/* ================================================
   Buttons
   ================================================ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: var(--success);
    border: none;
}

.btn-danger {
    background: var(--danger);
    border: none;
}

/* ================================================
   Alerts
   ================================================ */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 15px 20px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ================================================
   Badges
   ================================================ */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
}

/* ================================================
   Pagination
   ================================================ */
.pagination {
    gap: 5px;
}

.page-link {
    border-radius: var(--radius-sm) !important;
    border: none;
    color: var(--text-dark);
    padding: 8px 15px;
}

.page-item.active .page-link {
    background: var(--primary);
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 25px;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-content h3 {
        font-size: 18px;
    }
}

/* ================================================
   Utilities
   ================================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile Page */
.profile-avatar {
    margin-bottom: 15px;
}

.profile-stats {
    margin-top: 15px;
}

/* Payment Method Cards */
.payment-method-card {
    transition: all 0.2s;
}

.payment-method-card.border-primary {
    border-width: 2px !important;
}

/* Accordion Fixes */
.accordion-button:not(.collapsed) {
    background: #f8fafc;
    color: var(--text-dark);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--primary);
}

/* Code blocks */
pre {
    margin: 0;
}

code {
    font-family: 'Fira Code', 'Monaco', monospace;
}
