/**
 * Solei CFC - Application Stylesheet (Tailwind CSS Compatible)
 * Brand Colors: Gold #d4af37, Dark Blue #050934
 *
 * NOTE: Bootstrap has been REMOVED. All layout/utility classes use Tailwind CSS (CDN).
 * This file contains ONLY custom component styles that Tailwind can't handle inline.
 */

/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
    --solei-gold: #d4af37;
    --solei-gold-hover: #c0a030;
    --solei-gold-light: #f5e8b0;
    --solei-blue: #050934;
    --solei-blue-hover: #030720;
    --solei-blue-light: #1a2050;
    --bg-light: #f5f6fa;
}

/* ========================================
   Base Styles
   ======================================== */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #333;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Hidden until Alpine.js initializes */
[x-cloak] { display: none !important; }

/* ========================================
   CFC Currency Display
   ======================================== */
.cfc-amount {
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.cfc-amount.positive {
    color: #16a34a;
}

.cfc-amount.negative {
    color: #dc2626;
}

.cfc-symbol {
    font-size: 0.75em;
    color: var(--solei-gold);
    font-weight: 600;
}

/* ========================================
   Stat Card
   ======================================== */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--solei-blue);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 767px) {
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    .stat-card .stat-label {
        font-size: 0.72rem;
    }
}

/* ========================================
   Wallet Card (Gradient)
   ======================================== */
.wallet-card {
    background: linear-gradient(135deg, var(--solei-blue) 0%, var(--solei-blue-light) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.wallet-card::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 50%;
}

.wallet-card .balance {
    font-size: 2rem;
    font-weight: 700;
}

.wallet-card .balance-label {
    font-size: 0.85rem;
    opacity: 0.7;
}

@media (max-width: 767px) {
    .wallet-card .balance {
        font-size: 1.5rem;
    }
}

/* ========================================
   Network Tree
   ======================================== */
.network-tree .node {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.network-tree .node:hover {
    border-color: var(--solei-gold);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
}

.network-tree .node.current {
    border-color: var(--solei-gold);
    border-width: 2px;
    background: rgba(212, 175, 55, 0.05);
}

.tree-indent {
    margin-left: 2rem;
    border-left: 2px solid #e5e7eb;
    padding-left: 1rem;
}

/* ========================================
   Notifications
   ======================================== */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item.unread {
    border-left: 3px solid var(--solei-gold);
    background-color: rgba(212, 175, 55, 0.03);
}

/* ========================================
   Loading States
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-gold {
    color: var(--solei-gold);
}

/* ========================================
   Alpine.js DataTable - Modern Table System
   ======================================== */

/* ── Toolbar ── */
.dt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dt-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.dt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Search pill */
.dt-search {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 280px;
    flex: 1;
}

.dt-search > i {
    position: absolute;
    left: 0.7rem;
    color: #9ca3af;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 1;
}

.dt-search-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 0.35rem 2rem 0.35rem 2rem;
    font-size: 0.82rem;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.dt-search-input:focus {
    border-color: var(--solei-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
    background: #fff;
}

.dt-search-clear {
    position: absolute;
    right: 0.6rem;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.15s;
}

.dt-search-clear:hover {
    color: #374151;
}

/* Result counter */
.dt-count {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

/* Toolbar buttons */
.dt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85rem;
    padding: 0;
}

.dt-btn:hover {
    background: var(--solei-blue);
    color: #fff;
    border-color: var(--solei-blue);
}

/* ── Sortable Headers ── */
.dt-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    position: relative;
}

.dt-sortable:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

.dt-sortable i {
    font-size: 0.65rem;
    margin-left: 4px;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
    vertical-align: middle;
}

.dt-sortable:hover i {
    opacity: 0.8;
}

.dt-sort-active i {
    opacity: 1 !important;
    color: var(--solei-gold);
}

/* ── Density Modes ── */
.dt-compact tbody td {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.8rem;
}

.dt-compact thead th {
    padding: 0.45rem 0.6rem !important;
    font-size: 0.72rem;
}

.dt-normal tbody td {
    padding: 0.55rem 0.75rem;
}

.dt-spacious tbody td {
    padding: 0.85rem 0.75rem !important;
    font-size: 0.9rem;
}

.dt-spacious thead th {
    padding: 0.75rem 0.75rem !important;
}

/* ── Row Selection ── */
.dt-row-selected {
    background-color: rgba(212, 175, 55, 0.08) !important;
    border-left: 3px solid var(--solei-gold);
}

.dt-row-selected td:first-child {
    padding-left: calc(0.75rem - 3px);
}

/* ── Selection Bar ── */
.dt-selection-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--solei-blue) 0%, #1a2050 100%);
    color: #fff;
    font-size: 0.82rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

/* ── Mobile Toolbar ── */
@media (max-width: 767px) {
    .dt-toolbar {
        padding: 0.5rem 0.75rem;
    }

    .dt-search {
        max-width: 100%;
    }

    .dt-count {
        display: none;
    }

    .dt-toolbar-left {
        width: 100%;
    }
}

/* ========================================
   Mobile Card Tables (responsive override)
   On small screens, tables collapse into
   stacked card-style rows using data-label.
   ======================================== */
@media (max-width: 767px) {
    .overflow-x-auto {
        overflow: visible !important;
    }

    .overflow-x-auto > table {
        display: block !important;
        width: 100% !important;
    }

    .overflow-x-auto > table tbody {
        display: block !important;
    }

    .overflow-x-auto > table thead {
        display: none !important;
    }

    .overflow-x-auto > table tbody tr {
        display: block !important;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 1px 6px rgba(0,0,0,0.07);
        margin-bottom: 0.65rem;
        padding: 0.6rem 0.85rem;
        border: 1px solid #f3f4f6;
        position: relative;
    }

    .overflow-x-auto > table tbody tr:hover {
        box-shadow: 0 2px 10px rgba(212, 175, 55, 0.12);
        border-color: var(--solei-gold);
    }

    .overflow-x-auto > table tbody td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0 !important;
        border-bottom: 1px solid #f3f4f6 !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        font-size: 0.84rem;
        min-height: 32px;
        background: transparent !important;
        width: 100% !important;
    }

    .overflow-x-auto > table tbody td:last-child {
        border-bottom: none !important;
        padding-top: 0.5rem !important;
        justify-content: flex-end;
        gap: 0.3rem;
    }

    .overflow-x-auto > table tbody td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.7rem;
        color: var(--solei-blue);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
        margin-right: 0.75rem;
        opacity: 0.7;
    }

    .overflow-x-auto > table tbody td:last-child::before {
        display: none;
    }

    .overflow-x-auto > table tbody td[colspan] {
        display: block !important;
        text-align: center;
        border: none !important;
    }

    .overflow-x-auto > table tbody td[colspan]::before {
        display: none;
    }
}

/* ========================================
   Sidebar Scrollbar
   ======================================== */
.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

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

/* ========================================
   Smooth Transitions
   ======================================== */
.transition-smooth {
    transition: all 0.2s ease;
}

/* ========================================
   iOS Safe Area
   ======================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    footer {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)) !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar,
    .no-print,
    nav,
    footer {
        display: none !important;
    }

    body {
        background: #fff;
    }
}
