/* Glassmorphism & Gold Theme Core Stylesheet */

/* Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Poppins:wght@400;500;600;700;800&display=swap');

/* Variables */
:root {
    --bg-gradient: linear-gradient(135deg, #0A1628 0%, #1A1040 100%);
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    --gold-primary: #C9A84C;
    --gold-hover: #F0C040;
    --gold-gradient: linear-gradient(135deg, #C9A84C 0%, #F0C040 100%);
    --gold-glow: 0 0 15px rgba(201, 168, 76, 0.4);
    
    --text-primary: #FFFFFF;
    --text-secondary: #B0C4DE;
    --text-muted: #7A8E9E;
    
    --input-bg: rgba(10, 22, 40, 0.6);
    --input-focus-border: #C9A84C;
    
    --success: #38C172;
    --pending: #F6AD55;
    --flagged: #E53E3E;
    
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: var(--gold-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--gold-hover);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 22, 40, 0.5);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes rotateSpinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Global utility animation classes */
.animate-fade {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.staggered-1 { animation-delay: 0.05s; }
.staggered-2 { animation-delay: 0.1s; }
.staggered-3 { animation-delay: 0.15s; }
.staggered-4 { animation-delay: 0.2s; }
.staggered-5 { animation-delay: 0.25s; }

/* Frosted glass card system */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-glow);
    padding: 24px;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel-hover:hover {
    border-color: rgba(201, 168, 76, 0.3);
    box-shadow: var(--gold-glow);
}

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

/* Sidebar navigation */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 22, 40, 0.45);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    color: var(--gold-primary);
    font-size: 24px;
}

.brand-text {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.3s ease;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item {
    margin-bottom: 8px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.menu-link i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.menu-link:hover, .menu-item.active .menu-link {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid var(--gold-primary);
}

.menu-link:hover i, .menu-item.active .menu-link i {
    color: var(--gold-hover);
    text-shadow: var(--gold-glow);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
}

/* User Badge in Header / Sidebar */
.user-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.user-badge.admin {
    background: rgba(201, 168, 76, 0.2);
    color: var(--gold-primary);
    border: 1px solid var(--gold-primary);
}
.user-badge.broker {
    background: rgba(56, 193, 114, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}
.user-badge.super_admin {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid #9b59b6;
}

/* Main content layout */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top Header Bar */
.top-header {
    height: 70px;
    background: rgba(10, 22, 40, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.3s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(229, 62, 62, 0.15);
    color: #FF8A8A;
    border-color: #E53E3E;
}

/* Main Content Area */
.content-body {
    padding: 24px;
    flex-grow: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: scroll;
    word-wrap: break-word;
}

/* Page titles */
.page-title-area {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Premium Buttons */
.gold-btn {
    background: var(--gold-gradient);
    color: #0A1628;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gold-btn:hover {
    transform: scale(1.03);
    box-shadow: var(--gold-glow);
    background: var(--gold-hover);
}

.secondary-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

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

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-icon {
    font-size: 20px;
    color: var(--gold-primary);
}

.stat-value {
    font-size: 24px;
    font-family: var(--font-mono);
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Custom premium Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.custom-table th {
    background: rgba(10, 22, 40, 0.5);
    color: var(--gold-primary);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.custom-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    color: var(--text-secondary);
}

.custom-table tbody tr {
    transition: background 0.2s, box-shadow 0.2s;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 3px 0 0 var(--gold-primary);
}

/* Mono-styled numbers */
.mono-num {
    font-family: var(--font-mono);
}

/* Status badges */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-block;
}

.badge.confirmed, .badge.success {
    background: rgba(56, 193, 114, 0.15);
    color: var(--success);
    border: 1px solid rgba(56, 193, 114, 0.3);
}

.badge.pending, .badge.warning {
    background: rgba(246, 173, 85, 0.15);
    color: var(--pending);
    border: 1px solid rgba(246, 173, 85, 0.3);
}

.badge.flagged, .badge.danger {
    background: rgba(229, 62, 62, 0.15);
    color: var(--flagged);
    border: 1px solid rgba(229, 62, 62, 0.3);
}

/* Form controls & design inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control, .form-select, .form-textarea {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
    font-family: var(--font-body);
}

.form-control[readonly], .form-select[readonly] {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.25);
}

.form-select option {
    background: #0A1628;
    color: var(--text-primary);
}

/* Error message styling */
.text-danger {
    color: var(--flagged);
    font-size: 11px;
    margin-top: 4px;
}

/* Custom toast notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 350px;
}

.toast-message {
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(20px);
    border-left: 4px solid var(--gold-primary);
    box-shadow: var(--glass-glow);
    border-top: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0 12px 12px 0;
    padding: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-message.success {
    border-left-color: var(--success);
}
.toast-message.danger {
    border-left-color: var(--flagged);
    animation: slideInRight 0.3s, shake 0.5s 0.3s;
}
.toast-message.info {
    border-left-color: #4299E1;
}

/* Loading Spinners */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(201, 168, 76, 0.1);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: rotateSpinner 1s linear infinite;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    width: 100%;
    max-width: 500px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--gold-primary);
}

/* Tab controls */
.tabs-header {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 24px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 18px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.tab-btn.active, .tab-btn:hover {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Login Page specific style overrides */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 40px;
}

.login-logo {
    font-size: 48px;
    color: var(--gold-primary);
    text-shadow: var(--gold-glow);
    text-align: center;
    margin-bottom: 12px;
}

.login-title {
    text-align: center;
    font-size: 22px;
    letter-spacing: 2px;
    margin-bottom: 30px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Floating labels effect */
.floating-group {
    position: relative;
    margin-bottom: 24px;
}

.floating-group input {
    width: 100%;
    background: rgba(10, 22, 40, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 16px;
    color: var(--text-primary);
    outline: none;
    font-size: 14px;
}

.floating-group label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.3s ease;
    font-size: 14px;
}

.floating-group input:focus ~ label,
.floating-group input:not(:placeholder-shown) ~ label {
    top: 0;
    left: 12px;
    transform: translateY(-50%) scale(0.85);
    background: #0A1628;
    padding: 0 6px;
    color: var(--gold-primary);
}

.floating-group input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.2);
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-link span,
.sidebar.collapsed .user-badge {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 24px 0;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Icon action buttons for tables */
.icon-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    padding: 0;
}

.icon-btn:hover {
    transform: scale(1.1);
}

.icon-btn.edit-btn:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
    background: rgba(201, 168, 76, 0.1);
}

.icon-btn.delete-btn:hover {
    color: var(--flagged);
    border-color: var(--flagged);
    background: rgba(229, 62, 62, 0.1);
}

.icon-btn.pdf-btn:hover {
    color: #4299E1;
    border-color: #4299E1;
    background: rgba(66, 153, 225, 0.1);
}

/* Exchange rates page layout */
.exchange-rates-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

/* Dashboard two-column layouts */
.dashboard-two-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* Settings two-column layout */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Ensure content doesn't overflow */
.content-body {
    min-width: 0;
    max-width: 100%;
    overflow-x: scroll;
    word-wrap: break-word;
}

/* Prevent table overflow */
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    max-width: 100%;
}

/* Custom table minimum width to force horizontal scroll when needed */
.custom-table {
    min-width: 600px;
}

/* Ensure modals fit on all screens */
.modal-card {
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive grid override — prevent inline grid-template-columns from breaking */
[style*="grid-template-columns"] {
    max-width: 100%;
}

/* Page title area flex responsive */
.page-title-area {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-area > div {
    min-width: 0;
}

/* Responsive grid layouts and queries */
@media (max-width: 992px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.active {
        left: 0;
        width: var(--sidebar-width) !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .sidebar.active ~ .main-wrapper {
        margin-left: 0;
    }
    .exchange-rates-layout {
        grid-template-columns: 1fr !important;
    }
    .dashboard-two-col,
    .dashboard-bottom-grid,
    .settings-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .page-title-area {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .top-header {
        padding: 0 12px;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .header-right {
        gap: 10px;
    }
    .user-info {
        display: none;
    }
    .content-body {
        padding: 16px 12px;
    }
    .glass-panel {
        padding: 16px;
    }
    .modal-card {
        max-width: 95vw !important;
        margin: 10px;
    }
    .custom-table th,
    .custom-table td {
        padding: 10px 12px;
        font-size: 12px;
    }
    /* Transactions table: hide less important columns on smaller screens */
    .transactions-table-responsive .custom-table th:nth-child(n+8),
    .transactions-table-responsive .custom-table td:nth-child(n+8) {
        display: none;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .content-body {
        padding: 12px 8px;
    }
    .login-card {
        padding: 24px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .page-title {
        font-size: 20px;
    }
    .gold-btn, .secondary-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    /* Stat values smaller on tiny screens */
    .stat-value {
        font-size: 20px;
    }
}
