/* =========================================================================
   PREMIUM COMPONENTS - COMPONENTS.CSS
   ========================================================================= */

/* Cards - Universal styling for all generated cards */
.card, .settings-card, .admin-users-panel, .clan-card, .mod-user-card, .terminal-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover, .settings-card:hover, .clan-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    transform: translateY(-2px);
}

.glow-card {
    box-shadow: var(--gradient-glow);
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.card-title, .settings-card h2, .admin-users-panel h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-top: 0;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.settings-desc {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 25px;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Moderator Hub & Generic Cards */
.card-glass {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 20px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.card-glass h3 {
    margin-top: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mod-scroll-area {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    border: 1px solid var(--border-subtle);
    padding: 15px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

/* Inputs */
.input-label, label {
    display: block;
    text-align: left;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.input-base, input, select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 14px 18px;
    border-radius: 0;
    font-size: 14px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.input-base:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
    background: rgba(15, 16, 25, 0.9);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 14px 28px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button[data-action="login()"], button[data-action="changePassword()"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 14px 28px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-primary, button[data-action="login()"], button[data-action="changePassword()"] {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-primary:hover, button[data-action="login()"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.6);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.btn-danger, .btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover, .btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn-discord {
    background: #5865f2;
    color: white;
    box-shadow: 0 4px 15px rgba(88,101,242,0.3);
}
.btn-discord:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(88,101,242,0.5);
    filter: brightness(1.1);
}

.btn-sm, .btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-action-icon {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    color: white;
}
.btn-action-icon:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
    border-color: var(--color-primary);
}

.btn-inline-edit {
    background: transparent;
    border: none;
    color: var(--color-accent);
    cursor: pointer;
    font-size: 14px;
    margin-left: 6px;
    padding: 4px;
    transition: transform 0.2s, filter 0.2s;
}
}
.btn-inline-edit:hover {
    transform: scale(1.2);
    filter: brightness(1.5);
}

/* AI Hub Tabs */
.btn-hub-view {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
}
.btn-hub-view:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}
.btn-hub-view.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

/* Admin Controls & Edit Layout Button */
.admin-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 25px;
}
.btn-edit-mode {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: var(--color-primary);
    padding: 10px 20px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-edit-mode:hover {
    background: rgba(168, 85, 247, 0.2);
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}
.btn-edit-mode.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.6);
}

/* Drag and Drop Effects */
.sortable-ghost {
    opacity: 0.2 !important;
    background: var(--color-primary) !important;
    border: 2px dashed var(--color-primary) !important;
}
.sortable-chosen {
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    background: rgba(255,255,255,0.08);
    z-index: 100;
}
.sortable-drag {
    opacity: 0.9;
    transform: scale(1.02);
}
.move-handle {
    position: absolute;
    top: 20px;
    right: 20px;
    display: none;
    font-size: 20px;
    color: var(--text-dim);
    opacity: 0.5;
    cursor: grab;
}
.edit-mode-active .move-handle {
    display: block;
}
.edit-mode-active .settings-card {
    border-style: dashed !important;
    cursor: grab;
}
.edit-mode-active .settings-card:active {
    cursor: grabbing;
}

/* Grids */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
    align-items: start;
    border: none;
    border-radius: 0;
}
.admin-grid {
    display: block;
    column-width: 350px;
    column-gap: 15px;
    border: none;
    border-radius: 0;
    overflow: visible;
}
/* Inside admin-grid, cards share borders and have no radius */
.admin-grid .settings-card {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    border-radius: 0;
    border: 1px solid var(--border-subtle);
    box-shadow: none;
    margin: 0 0 15px 0;
}
.admin-grid .settings-card:hover {
    transform: none;
    background: var(--bg-card-hover);
    z-index: 1;
    border-color: rgba(168, 85, 247, 0.3);
}
#admin-clan-grid, .clan-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-items: start;
}

/* Dividers */
.divider {
    position: relative;
    margin: 30px 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-subtle);
}

.divider span {
    position: relative;
    background: var(--bg-main);
    padding: 0 15px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: 0;
}

/* Callouts */
.callout-info {
    background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-left: 4px solid var(--color-accent);
    padding: 20px;
    border-radius: 0;
}
.callout-danger {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--color-danger);
    padding: 20px;
    border-radius: 0;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }

.stat-title {
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 10px;
}
.stat-value {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}
.stat-card.highlight {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05), rgba(59, 130, 246, 0.05));
    border-color: rgba(168, 85, 247, 0.3);
}

/* Search Container */
.search-container {
    position: relative;
    width: 350px;
}
.search-container .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    color: var(--text-main);
}
.search-container input {
    padding-left: 50px;
    margin: 0;
    background: rgba(255,255,255,0.03);
    border-radius: 0;
}

/* Tables (Leaderboard / Data) */
.table-container {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.data-table, table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, table th {
    padding: 20px 25px;
    background: rgba(255,255,255,0.02);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td, table td {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 15px;
    vertical-align: middle;
}

.data-table tr:hover td, table tr:hover td {
    background: rgba(255,255,255,0.03);
}

/* User Cells in Tables */
.user-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0;
    object-fit: cover;
    border: 2px solid var(--border-subtle);
}
.user-info .username { font-weight: 700; font-size: 16px; color: #fff; }
.user-info .user-id { font-size: 12px; color: var(--text-dim); }

/* Pilled Stats */
.stat-pill {
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid var(--border-subtle);
}
.points { color: var(--color-accent); border-color: rgba(6, 182, 212, 0.3); }
.invites { color: var(--color-primary); border-color: rgba(168, 85, 247, 0.3); }

/* Leaderboard Top 3 - flex so CSS order works */
.leaderboard-top-three {
    display: flex;
    gap: 35px;
    margin-bottom: 40px;
    align-items: flex-end;
    justify-content: center;
}
/* Base leader card */
.leader-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.leader-card:hover { transform: translateY(-5px); }
/* rank-1 = gold (centre), rank-2 = silver (left), rank-3 = bronze (right) */
.leader-card.rank-1 {
    order: 2;
    flex: 0 1 380px;
    border-color: rgba(250, 204, 21, 0.5);
    box-shadow: 0 0 30px rgba(250, 204, 21, 0.2);
    background: linear-gradient(180deg, rgba(250,204,21,0.06) 0%, var(--bg-card) 60%);
    padding-top: 35px;
    padding-bottom: 35px;
}
.leader-card.rank-2 {
    order: 1;
    flex: 0 1 320px;
    margin-bottom: 25px;
    border-color: rgba(148, 163, 184, 0.4);
    padding-top: 30px;
    padding-bottom: 30px;
}
.leader-card.rank-3 {
    order: 3;
    flex: 0 1 320px;
    margin-bottom: 25px;
    border-color: rgba(180, 83, 9, 0.4);
    padding-top: 30px;
    padding-bottom: 30px;
}

/* Announce side-by-side layout */
.announce-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.announce-builder {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 25px;
}
.announce-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: 25px;
    position: sticky;
    top: 20px;
}

.leader-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 3px solid rgba(255,255,255,0.1);
}
.leader-card.rank-1 .leader-avatar { width: 100px; height: 100px; border-color: #facc15; }
.leader-card.rank-2 .leader-avatar { border-color: #94a3b8; }
.leader-card.rank-3 .leader-avatar { border-color: #b45309; }

.top-name, .leader-name { font-weight: 800; font-size: 22px; margin-bottom: 5px; color: #fff; }
.top-score, .leader-stats { color: var(--color-primary); font-size: 20px; font-weight: 800; }

/* Clan Management Cards */
.clan-card {
    display: flex;
    flex-direction: column;
}
.clan-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 15px;
}
.clan-title-box h2 {
    font-size: 20px;
    color: #fff;
    margin-bottom: 2px;
}
.clan-title-box .clan-tag-subtitle {
    font-size: 11px;
    color: var(--text-dim);
}
.clan-card-buttons {
    display: flex;
    gap: 10px;
}
.clan-card-buttons button {
    padding: 8px 14px;
    font-size: 11px;
    border-radius: 0;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 700;
}
.clan-card-buttons .btn-edit { background: var(--color-secondary); }
.clan-card-buttons .btn-delete { background: var(--color-danger); }

.clan-stat-item {
    background: rgba(0,0,0,0.2);
    padding: 10px 15px;
    border-radius: 0;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mini-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.member-info { display: flex; align-items: center; gap: 8px; }
.member-actions { display: flex; gap: 5px; }
.member-actions button {
    background: transparent; border: none; color: var(--text-dim); cursor: pointer;
}
.member-actions button:hover { color: #fff; }

/* Lightbox Modal */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(15px);
}
.lightbox-close {
    position: absolute;
    top: 30px; right: 40px;
    color: white; font-size: 40px; font-weight: 300; cursor: pointer;
    z-index: 3001;
    transition: 0.3s;
}
.lightbox-close:hover { color: var(--color-primary); transform: scale(1.1); }
.lightbox-nav-container {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 80vh;
}
.lightbox-nav-btn {
    background: transparent; color: rgba(255,255,255,0.5); border: none; font-size: 60px;
    cursor: pointer; padding: 20px; transition: 0.3s;
}
.lightbox-nav-btn:hover { color: #fff; transform: scale(1.1); }
.lightbox-main { position: relative; max-width: 80vw; max-height: 80vh; }
.lightbox-content {
    max-width: 100%; max-height: 80vh; border-radius: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Badges */
.badge, .role-badge {
    padding: 6px 12px;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.role-admin { background: rgba(168, 85, 247, 0.2); color: var(--color-primary); border: 1px solid rgba(168, 85, 247, 0.3); }
.role-user { background: rgba(59, 130, 246, 0.2); color: var(--color-secondary); border: 1px solid rgba(59, 130, 246, 0.3); }

/* Utility States */
.spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-dim);
}
.modern-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-primary); }
input:checked + .slider:before { transform: translateX(20px); }
/* Discord Preview Styles */
.discord-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.discord-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.discord-name {
    font-weight: 500;
    color: #fff;
    font-size: 15px;
    margin-right: 6px;
}
.discord-bot-tag {
    background: #5865F2;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
    margin-right: 6px;
    vertical-align: middle;
}
.discord-time {
    color: #a3a6aa;
    font-size: 12px;
}
