/* ============================================
   BotDash Admin - Modern Styling
   ============================================ */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --bg-dark: #1e293b;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Login Page
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    margin-top: 30px;
}

/* ============================================
   Header
   ============================================ */

.main-header {
    background: var(--card-bg);
    box-shadow: var(--shadow-md);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    display: flex;
    gap: 16px;
    flex: 1;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.username {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

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

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 4px solid;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: #fef2f2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success-color);
    color: #166534;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.icon {
    font-size: 16px;
}

/* ============================================
   Table
   ============================================ */

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr.expired {
    background: #fef2f2;
    opacity: 0.8;
}

.data-table tbody tr.expired:hover {
    background: #fee2e2;
}

.actions {
    display: flex;
    gap: 8px;
}

.text-center {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
}

.text-center a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.text-center a:hover {
    text-decoration: underline;
}

code {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--primary-color);
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ============================================
   Forms
   ============================================ */

.form-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}

.guild-form {
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Detail View
   ============================================ */

.detail-container {
    max-width: 900px;
}

.detail-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.detail-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.token-display {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    flex: 1;
    min-width: 200px;
}

/* ============================================
   Footer
   ============================================ */

.main-footer {
    background: var(--card-bg);
    margin-top: 64px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   Bot Tags & Lists
   ============================================ */

.bot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bot-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bot-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
}

.bot-item strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.token-preview {
    font-size: 11px;
    color: var(--text-secondary);
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    padding: 10px;
    background: #f8fafc;
    border-radius: var(--radius);
    border-left: 3px solid var(--info-color);
}

.user-item a {
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-item a:hover {
    color: var(--primary-color);
}

.user-item code {
    font-size: 12px;
}

/* ============================================
   Checkbox Selection
   ============================================ */

.bot-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: var(--radius);
    max-height: 400px;
    overflow-y: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid var(--border-color);
}

.checkbox-label:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.checkbox-label span {
    flex: 1;
    font-weight: 500;
}

.text-muted {
    color: var(--text-secondary);
    font-style: italic;
}

.user-info-box {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary-color);
}

.user-info-box h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.user-info-box p {
    margin: 8px 0;
    color: var(--text-secondary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .main-nav {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .form-container {
        padding: 20px;
    }
}

/* ============================================
   User Cards & Guild Cards
   ============================================ */

.users-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.user-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    transition: all 0.2s ease;
}

.user-card.expanded {
    box-shadow: var(--shadow-lg);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 16px;
}

.user-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.user-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-card-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.user-card.expanded .user-card-body {
    max-height: 2000px;
    opacity: 1;
}

.user-toggle {
    cursor: pointer;
    margin: 0;
    padding: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.user-toggle::after {
    content: '+';
    font-size: 18px;
    color: var(--primary-color);
    transition: transform 0.2s ease;
}

.user-card.expanded .user-toggle::after {
    content: '-';
}

.guilds-section {
    margin-top: 24px;
}

.guilds-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.guilds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.guild-card {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s;
}

.guild-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.guild-card.expired {
    background: #fef2f2;
    border-left-color: var(--danger-color);
    opacity: 0.8;
}

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

.guild-header h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.guild-details {
    margin-bottom: 12px;
}

.guild-details p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.guild-details strong {
    color: var(--text-primary);
}

.bot-names {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.guild-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* ============================================
   Animations & Transitions
   ============================================ */

* {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

