/*
================================================================================
| ROOBUX - Admin Panel Mobile Styles
| Mobile-only CSS for admin panel management on phones
================================================================================
*/

/* Apply mobile styles only on screens 768px and below */
@media only screen and (max-width: 768px) {
    
    /* === LAYOUT === */
    .admin-layout {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    /* Hide desktop menu toggle */
    #menu-toggle-btn {
        display: none !important;
    }

    /* === SIDEBAR === */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 9999;
        background: var(--color-bg-card, #1a1a1a);
        border-right: 1px solid var(--color-border, #333);
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-bottom: 60px;
    }

    .admin-sidebar.is-visible {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.is-visible {
        display: block;
        opacity: 1;
    }

    /* Sidebar Header */
    .sidebar-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-border, #333);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-logo {
        font-size: 1.5rem;
        font-weight: 700;
    }

    /* Admin User Info */
    .admin-user-info {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        border-bottom: 1px solid var(--color-border, #333);
        color: var(--color-text-secondary, #888);
    }

    .admin-user-info strong {
        display: block;
        color: var(--color-text-primary, #fff);
        font-size: 0.9rem;
        margin-top: 0.25rem;
        word-break: break-word;
    }

    /* Sidebar Navigation */
    .sidebar-nav {
        padding: 0.5rem 0;
    }

    .sidebar-nav-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .sidebar-nav-list li {
        margin: 0;
    }

    .admin-nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.875rem 1rem;
        color: var(--color-text-secondary, #888);
        text-decoration: none;
        transition: all 0.2s ease;
        border-left: 3px solid transparent;
        font-size: 0.95rem;
    }

    .admin-nav-link:active {
        background: rgba(255, 255, 255, 0.05);
    }

    .admin-nav-link.active {
        background: rgba(0, 191, 255, 0.1);
        color: var(--color-primary, #00BFFF);
        border-left-color: var(--color-primary, #00BFFF);
    }

    .nav-item-group {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-icon {
        font-size: 1.25rem;
        min-width: 24px;
        text-align: center;
    }

    /* Badges */
    .badge {
        padding: 0.125rem 0.5rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 600;
    }

    .badge-warning {
        background: rgba(255, 191, 0, 0.2);
        color: #FFBF00;
    }

    .badge-primary {
        background: rgba(0, 191, 255, 0.2);
        color: var(--color-primary, #00BFFF);
    }

    .badge-danger {
        background: rgba(220, 38, 38, 0.2);
        color: #dc2626;
    }

    /* Sidebar Footer */
    .sidebar-footer {
        position: fixed;
        bottom: 0;
        left: -100%;
        width: 280px;
        padding: 1rem;
        background: var(--color-bg-card, #1a1a1a);
        border-top: 1px solid var(--color-border, #333);
        transition: left 0.3s ease;
        z-index: 10000;
    }

    .admin-sidebar.is-visible + .admin-main .sidebar-footer,
    .admin-sidebar.is-visible .sidebar-footer {
        left: 0;
    }

    /* === MAIN CONTENT === */
    .admin-main {
        flex: 1;
        width: 100%;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    /* === HEADER === */
    .admin-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--color-bg-card, #1a1a1a);
        border-bottom: 1px solid var(--color-border, #333);
        padding: 0.75rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .admin-header-left {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
        min-width: 0;
    }

    .menu-toggle-btn {
        background: none;
        border: none;
        color: var(--color-text-primary, #fff);
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    #admin-header-title {
        font-size: 1.125rem;
        font-weight: 600;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .admin-header-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .admin-header-right .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* === CONTENT === */
    .admin-content {
        flex: 1;
        padding: 1rem;
        overflow-x: hidden;
    }

    .admin-tab-content {
        display: none;
    }

    .admin-tab-content.is-active {
        display: block;
    }

    /* === STAT CARDS === */
    .stat-card-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-radius: 8px;
        padding: 1rem;
    }

    .stat-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }

    .stat-card-header h5 {
        margin: 0;
        font-size: 0.8rem;
        color: var(--color-text-secondary, #888);
        font-weight: 500;
    }

    .stat-card-icon {
        font-size: 1.25rem;
    }

    .stat-card-value {
        font-size: 1.5rem;
        font-weight: 700;
        margin: 0;
        color: var(--color-text-primary, #fff);
    }

    .stat-card-footer {
        margin-top: 0.5rem;
        font-size: 0.75rem;
        color: var(--color-text-secondary, #888);
    }

    /* === TABLE CONTROLS === */
    .table-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .search-bar {
        width: 100%;
    }

    .table-controls select,
    .table-controls .btn {
        width: 100%;
    }

    /* === TABLES === */
    .table-container {
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 1rem;
    }

    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        width: 100%;
        min-width: 600px;
        border-collapse: collapse;
        font-size: 0.85rem;
    }

    .admin-table thead {
        background: var(--color-bg-main, #0d0d0d);
    }

    .admin-table th {
        padding: 0.75rem 0.5rem;
        text-align: left;
        font-weight: 600;
        color: var(--color-text-secondary, #888);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border-bottom: 1px solid var(--color-border, #333);
        white-space: nowrap;
    }

    .admin-table td {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--color-border, #333);
        color: var(--color-text-primary, #fff);
    }

    .admin-table tr:last-child td {
        border-bottom: none;
    }

    .admin-table .email {
        color: var(--color-primary, #00BFFF);
        font-size: 0.8rem;
        word-break: break-all;
    }

    .admin-table .address,
    .admin-table .tx-hash {
        font-family: monospace;
        font-size: 0.75rem;
        word-break: break-all;
    }

    /* Table Action Buttons */
    .admin-table .btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
        margin: 0.125rem;
        white-space: nowrap;
    }

    /* === PAGINATION === */
    .pagination-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .pagination-controls .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    #users-page-info,
    #deposits-page-info,
    #withdrawals-page-info,
    #referrals-page-info,
    #messages-page-info,
    #audit-page-info {
        font-size: 0.85rem;
        color: var(--color-text-secondary, #888);
    }

    /* === FORMS === */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        font-size: 0.9rem;
        color: var(--color-text-primary, #fff);
    }

    .form-control {
        width: 100%;
        padding: 0.75rem;
        background: var(--color-bg-main, #0d0d0d);
        border: 1px solid var(--color-border, #333);
        border-radius: 8px;
        color: var(--color-text-primary, #fff);
        font-size: 0.9rem;
    }

    .form-control:focus {
        outline: none;
        border-color: var(--color-primary, #00BFFF);
        box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.1);
    }

    .form-text {
        display: block;
        margin-top: 0.375rem;
        font-size: 0.8rem;
        color: var(--color-text-secondary, #888);
    }

    /* Toggle Switch */
    .toggle-switch {
        display: inline-block;
        width: 50px;
        height: 26px;
        position: relative;
    }

    .toggle-switch input[type="checkbox"] {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .toggle-switch .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #333;
        transition: 0.3s;
        border-radius: 26px;
    }

    .toggle-switch .slider:before {
        position: absolute;
        content: "";
        height: 20px;
        width: 20px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: 0.3s;
        border-radius: 50%;
    }

    .toggle-switch input:checked + .slider {
        background-color: var(--color-primary, #00BFFF);
    }

    .toggle-switch input:checked + .slider:before {
        transform: translateX(24px);
    }

    /* === BUTTONS === */
    .btn {
        display: inline-block;
        padding: 0.625rem 1.25rem;
        border: none;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        text-decoration: none;
        transition: all 0.2s ease;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .btn-primary {
        background: linear-gradient(135deg, #00BFFF, #0080FF);
        color: white;
    }

    .btn-secondary {
        background: var(--color-bg-main, #333);
        color: var(--color-text-primary, #fff);
        border: 1px solid var(--color-border, #555);
    }

    .btn-success {
        background: #00FF00;
        color: #000;
    }

    .btn-danger {
        background: #ff4444;
        color: white;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-block {
        width: 100%;
        display: block;
    }

    /* === MODALS === */
    .modal {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0, 0, 0, 0.9);
        overflow-y: auto;
        padding: 1rem;
    }

    .modal.is-visible {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 2rem;
    }

    .modal-content {
        position: relative;
        width: 100%;
        max-width: 500px;
        background: var(--color-bg-card, #1a1a1a);
        border-radius: 12px;
        margin-bottom: 2rem;
    }

    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-border, #333);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .modal-header h4 {
        margin: 0;
        font-size: 1.125rem;
    }

    .modal-close-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--color-text-secondary, #888);
        cursor: pointer;
        padding: 0;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .modal-close-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }

    .modal-footer {
        padding: 1rem;
        border-top: 1px solid var(--color-border, #333);
        display: flex;
        gap: 0.5rem;
        flex-direction: column;
    }

    .modal-footer .btn {
        flex: 1;
        width: 100%;
    }

    /* Transaction Details */
    .tx-details {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .tx-details-item {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--color-border, #333);
    }

    .tx-details-item:last-child {
        border-bottom: none;
    }

    .tx-details-item label {
        font-weight: 600;
        color: var(--color-text-secondary, #888);
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .tx-details-item span {
        text-align: right;
        color: var(--color-text-primary, #fff);
        font-size: 0.85rem;
        word-break: break-word;
    }

    /* === CARDS === */
    .card {
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-radius: 8px;
        margin-bottom: 1.5rem;
    }

    .card-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-border, #333);
    }

    .card-title {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

    .card-body {
        padding: 1rem;
    }

    /* === SUPPORT CHAT === */
    .chat-list-panel {
        display: none;
    }

    .chat-conversation-panel {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 140px);
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-radius: 8px;
    }

    .chat-conversation-header {
        padding: 1rem;
        border-bottom: 1px solid var(--color-border, #333);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }

    .chat-message {
        margin-bottom: 1rem;
        padding: 0.75rem;
        border-radius: 8px;
        max-width: 85%;
    }

    .chat-message.user {
        background: rgba(0, 191, 255, 0.1);
        margin-left: 0;
        margin-right: auto;
    }

    .chat-message.admin {
        background: rgba(0, 255, 0, 0.1);
        margin-left: auto;
        margin-right: 0;
    }

    .chat-message-meta {
        font-size: 0.7rem;
        color: var(--color-text-secondary, #888);
        margin-top: 0.375rem;
    }

    .chat-input-area {
        padding: 1rem;
        border-top: 1px solid var(--color-border, #333);
        display: flex;
        gap: 0.5rem;
    }

    .chat-input-area textarea {
        flex: 1;
        min-height: 60px;
        resize: vertical;
    }

    .chat-input-area .btn {
        align-self: flex-end;
        white-space: nowrap;
    }

    /* === SPINNER === */
    .spinner-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.8);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 99999;
    }

    .spinner-overlay.is-visible {
        display: flex;
    }

    .spinner {
        width: 50px;
        height: 50px;
        border: 4px solid rgba(0, 191, 255, 0.3);
        border-top-color: var(--color-primary, #00BFFF);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    /* === TOAST === */
    #toast-container {
        position: fixed;
        top: 70px;
        right: 1rem;
        left: 1rem;
        z-index: 100000;
        pointer-events: none;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .toast {
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-left: 4px solid var(--color-primary, #00BFFF);
        border-radius: 8px;
        padding: 0.875rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        pointer-events: auto;
        font-size: 0.85rem;
        word-wrap: break-word;
        animation: slideIn 0.3s ease;
    }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(100%);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* === UTILITIES === */
    .text-center {
        text-align: center;
    }

    .text-error,
    .text-danger {
        color: var(--color-error, #ff4444) !important;
    }

    .text-warning {
        color: #FFBF00 !important;
    }

    .text-secondary,
    .text-muted {
        color: var(--color-text-secondary, #888) !important;
    }

    .increase {
        color: var(--color-success, #00FF00);
    }

    .decrease {
        color: var(--color-error, #ff4444);
    }

    /* Hide desktop-specific elements */
    .admin-layout.is-collapsed {
        /* No effect on mobile */
    }

    /* Settings Grid */
    .settings-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Dashboard Chart */
    .dashboard-chart-container {
        padding: 1rem;
    }

    .dashboard-chart-container canvas {
        max-height: 250px;
    }

    /* Make single column for smaller stat grids */
    @media only screen and (max-width: 480px) {
        .stat-card-grid {
            grid-template-columns: 1fr;
        }

        .admin-header-right .btn-sm {
            font-size: 0.7rem;
            padding: 0.25rem 0.5rem;
        }

        #admin-header-title {
            font-size: 1rem;
        }

        .modal-footer {
            flex-direction: column;
        }
    }

    /* Landscape mode adjustments */
    @media only screen and (max-height: 500px) and (orientation: landscape) {
        .admin-header {
            padding: 0.5rem 1rem;
        }

        .admin-content {
            padding: 0.75rem;
        }

        .stat-card {
            padding: 0.75rem;
        }

        .chat-conversation-panel {
            height: calc(100vh - 100px);
        }
    }
}