/* Admin Users Page Responsive Styles */

/* Global Improvements */
* {
    box-sizing: border-box;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.admin-container {
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    background: #0A0A0B;
}

/* Header Improvements */
.admin-header {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    padding: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-content h1 {
    font-family: 'Orbitron', monospace;
    color: #00FF88;
    font-size: 1.75rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Button Improvements */
.btn-primary, .btn-action {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #00FF88 0%, #00D4FF 100%);
    color: #0A0A0B;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover, .btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Back button specific styling */
.header-actions a.btn-primary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-actions a.btn-primary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00FF88;
}

/* Container padding */
.users-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Stats Grid Improvements */
.users-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding: 0 1.5rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.1);
}

.stat-box h3 {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.stat-box .value {
    font-size: 2rem;
    font-weight: bold;
    color: #00FF88;
    font-family: 'JetBrains Mono', monospace;
}

/* Search Bar Improvements */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0 1.5rem;
    position: relative;
}

.search-bar input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    padding-left: 3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-bar::before {
    content: "🔍";
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    opacity: 0.5;
    pointer-events: none;
}

.search-bar input:focus {
    outline: none;
    border-color: #00FF88;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Clear search button */
.search-bar .clear-search {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: none;
}

.search-bar input:not(:placeholder-shown) ~ .clear-search {
    display: block;
}

.search-bar .clear-search:hover {
    color: #00FF88;
}

/* Table Container */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0;
    margin: 0 1.5rem;
    overflow: hidden;
}

/* Table Wrapper for horizontal scroll */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Users Table Improvements */
.users-table {
    width: 100%;
    min-width: 800px;
    background: transparent;
    border-collapse: collapse;
}

.users-table th {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 1.25rem;
    text-align: left;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

.users-table tr:hover td {
    background: rgba(0, 255, 136, 0.05);
}

/* User Info Cell */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.user-avatar, .user-avatar-text {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.user-avatar {
    object-fit: cover;
}

.user-avatar-text {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    font-size: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-username {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Subscription Badges */
.subscription-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-signals {
    background: rgba(0, 255, 136, 0.2);
    color: #00FF88;
}

.badge-course {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.badge-discount {
    background: rgba(255, 215, 0, 0.2);
    color: gold;
}

.badge-free {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

/* Modal Improvements */
#userDetailsModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
}

.modal-content {
    background: #0A0A0B;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: #00FF88;
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

/* Mobile Card Layout for Table */
.users-cards {
    display: none;
    padding: 1rem;
    gap: 1rem;
}

.user-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.user-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.card-value {
    color: white;
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-actions button {
    flex: 1;
    padding: 0.6rem;
    font-size: 0.85rem;
}

/* Responsive Breakpoints */

/* Tablet - 768px to 1024px */
@media (max-width: 1024px) {
    .users-stats {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1rem;
    }

    .stat-box .value {
        font-size: 1.75rem;
    }

    .modal-content {
        margin: 1rem auto;
        padding: 1.5rem;
    }
}

/* Mobile - Below 768px */
@media (max-width: 768px) {
    /* Mobile Menu Button */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Header */
    .admin-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .header-actions button,
    .header-actions a {
        flex: 1;
        justify-content: center;
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    /* Container */
    .users-container {
        padding: 1rem;
    }

    /* Stats */
    .users-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 1rem;
    }

    .stat-box {
        padding: 1.25rem 0.75rem;
    }

    .stat-box h3 {
        font-size: 0.75rem;
    }

    .stat-box .value {
        font-size: 1.5rem;
    }

    /* Search */
    .search-bar {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }

    .search-bar input {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Hide table on mobile, show cards */
    #desktopTable {
        display: none;
    }

    .users-cards {
        display: flex;
        flex-direction: column;
    }

    /* Modal */
    #userDetailsModal {
        padding: 0.5rem;
    }

    .modal-content {
        padding: 1.25rem;
        margin: 1rem auto;
        border-radius: 12px;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .close-btn {
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
}

/* Small Mobile - Below 480px */
@media (max-width: 480px) {
    /* Header */
    .header-content h1 {
        font-size: 1.25rem;
    }

    .header-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-actions button,
    .header-actions a {
        width: 100%;
    }

    /* Stats - Single column */
    .users-stats {
        grid-template-columns: 1fr;
        padding: 0;
    }

    .stat-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 1rem;
    }

    .stat-box h3 {
        margin-bottom: 0;
    }

    .stat-box .value {
        font-size: 1.25rem;
    }

    /* Search */
    .search-bar {
        padding: 0;
    }

    /* User Cards */
    .user-card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
    }

    .user-avatar, .user-avatar-text {
        width: 60px;
        height: 60px;
        font-size: 1.25rem;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions button {
        width: 100%;
    }

    /* Modal */
    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
        max-width: 100%;
    }

    .modal-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .close-btn {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

/* Landscape Mode */
@media (max-width: 896px) and (orientation: landscape) {
    .admin-header {
        padding: 0.75rem 1rem;
    }

    .header-content h1 {
        font-size: 1.25rem;
    }

    .users-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-box {
        padding: 1rem;
    }

    .stat-box .value {
        font-size: 1.25rem;
    }
}

/* Large Screens */
@media (min-width: 1440px) {
    .users-container {
        max-width: 1600px;
    }

    .users-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .stat-box {
        padding: 2rem;
    }

    .stat-box .value {
        font-size: 2.5rem;
    }

    .modal-content {
        max-width: 900px;
    }
}

/* Dark mode optimization */
@media (prefers-color-scheme: dark) {
    .glass-card {
        background: rgba(0, 0, 0, 0.5);
    }

    .stat-box {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Scroll indicator for mobile table */
.table-scroll-indicator {
    display: none;
    text-align: center;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 0 0 12px 12px;
    margin-top: -1px;
}

@media (max-width: 768px) {
    .table-scroll-indicator {
        display: block;
    }
}

/* Loading state */
#usersTable p {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
}

.empty-state h3 {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.95rem;
}

/* Animation for cards */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-card {
    animation: slideIn 0.3s ease forwards;
}

.user-card:nth-child(1) { animation-delay: 0.05s; }
.user-card:nth-child(2) { animation-delay: 0.1s; }
.user-card:nth-child(3) { animation-delay: 0.15s; }
.user-card:nth-child(4) { animation-delay: 0.2s; }
.user-card:nth-child(5) { animation-delay: 0.25s; }

/* Scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}

/* Print styles */
@media print {
    .header-actions,
    .mobile-menu-toggle,
    .btn-action {
        display: none !important;
    }

    .admin-container {
        background: white;
        color: black;
    }

    .users-table th,
    .users-table td {
        border: 1px solid black;
        color: black;
    }
}