/* Modern Custom Design System for AsiaPay Admin */
:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --border-color: #334155;
    --border-light: #475569;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --accent: #38bdf8;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    font-size: 0.925rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: #7dd3fc;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.app-navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.navbar-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-badge {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.nav-item:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #fff;
    background-color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    background-color: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

/* Main Container */
.main-content {
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-color: var(--border-color);
}

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

.btn-outline-danger {
    background-color: transparent;
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
    background-color: var(--danger-light);
    border-color: var(--danger);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-icon-danger:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

/* Cards & Stats */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background-color: rgba(15, 23, 42, 0.4);
}

.stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.95rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(56, 189, 248, 0.12));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 9999px;
    font-size: 0.825rem;
    color: var(--text-muted);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stats-badge svg {
    color: var(--accent);
}

.stats-badge strong {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.15rem 0.65rem;
    border-radius: 9999px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control, select.form-control {
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Search Box */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-box {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.search-box svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.search-box input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.85rem 0.55rem 2.4rem;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.85rem;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.badge-code {
    background-color: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.badge-secondary {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
    border: 1px solid var(--border-color);
}

/* Table Design & Matrix Table */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: rgba(15, 23, 42, 0.7);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Matrix Table Specifics */
.matrix-scroll-wrapper {
    overflow-x: auto;
    max-width: 100%;
    position: relative;
    max-height: 70vh;
}

.table-matrix {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

.table-matrix th, .table-matrix td {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    padding: 0;
    height: 44px;
    white-space: nowrap;
}

.table-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #0f172a;
    padding: 0.4rem 0.25rem;
}

/* Sticky Headers & Columns */
.sticky-col {
    position: sticky;
    z-index: 15;
    background-color: var(--bg-card);
    text-align: left !important;
    padding: 0.5rem 0.85rem !important;
}

.table-matrix thead .sticky-col {
    z-index: 25;
    background-color: #0f172a;
}

.sticky-col.first-col {
    left: 0;
    min-width: 170px;
    max-width: 200px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
}

.sticky-col.second-col {
    left: 170px;
    min-width: 110px;
    box-shadow: 3px 0 5px rgba(0, 0, 0, 0.3);
}

.sticky-col-right {
    position: sticky;
    right: 0;
    z-index: 15;
    background-color: #111827;
    box-shadow: -3px 0 5px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    padding: 0.5rem 0.85rem !important;
}

.table-matrix thead .sticky-col-right {
    z-index: 25;
    background-color: #0f172a;
}

.day-col {
    min-width: 44px;
    width: 44px;
}

.weekend-header {
    background-color: rgba(99, 102, 241, 0.08) !important;
    color: var(--accent) !important;
}

.day-num {
    font-size: 0.9rem;
    font-weight: 800;
}

.day-name {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 600;
}

/* Matrix Cells & Editable Inputs */
.matrix-cell {
    cursor: pointer;
    transition: background-color 0.15s;
    user-select: none;
}

.matrix-cell:hover {
    background-color: var(--primary-light) !important;
}

.cell-empty {
    color: var(--text-dim);
}

.cell-has-value {
    color: #fff;
    font-weight: 700;
}

.cell-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 4px;
}

.cell-input {
    width: 100%;
    height: 100%;
    background-color: #0f172a;
    border: 2px solid var(--primary);
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    outline: none;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    padding: 0;
}

/* Daily Totals Row */
.daily-totals-row td {
    background-color: #0f172a !important;
    font-weight: 800;
    color: var(--accent);
    border-top: 2px solid var(--border-color);
}

.grand-total-cell {
    background-color: var(--primary-hover) !important;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 800;
}

/* User Avatar Mini */
.user-avatar-mini {
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.user-name-cell {
    display: flex;
    align-items: center;
}

/* Login Page Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
}

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

.brand-header .brand-logo {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin: 0 auto 1rem auto;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.brand-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}

.brand-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

.input-wrapper input {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.5rem;
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.login-help {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-dim);
}

.login-help code {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: var(--accent);
}

/* Modals & Alerts */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background-color: var(--bg-card);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-24px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background-color: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.modal-icon-badge {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
    flex-shrink: 0;
}

.modal-icon-shield {
    background: linear-gradient(135deg, #0ea5e9, var(--primary));
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.modal-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #fff;
    background-color: var(--danger-light);
    border-color: var(--danger);
    transform: scale(1.1) rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-body .form-group {
    margin-bottom: 0;
}

.input-wrapper select.form-control {
    width: 100%;
    padding-left: 2.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: rgba(15, 23, 42, 0.5);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: var(--danger-light);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background-color: var(--success-light);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 300;
    padding: 0.85rem 1.25rem;
    background-color: var(--bg-card);
    border: 1px solid var(--primary);
    color: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    animation: toastIn 0.3s ease;
}

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

/* Utilities */
.d-none { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-weight-600 { font-weight: 600; }
.font-weight-700 { font-weight: 700; }
.form-help { font-size: 0.75rem; color: var(--text-dim); }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    padding: 1rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}
