/* ========== CSS Custom Properties ========== */
:root {
    --color-bg: #0f0f1a;
    --color-surface: rgba(255, 255, 255, 0.05);
    --color-surface-hover: rgba(255, 255, 255, 0.1);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-text: #e8e8ed;
    --color-text-muted: #8a8a9a;
    --color-text-subtle: #5a5a6a;

    --gradient-auth: linear-gradient(135deg, #ff6b35, #f7c948);
    --gradient-admin: linear-gradient(135deg, #667eea, #764ba2);
    --gradient-success: linear-gradient(135deg, #43e97b, #38f9d7);
    --gradient-hero: linear-gradient(160deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.5);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--gradient-hero);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== Hero Section ========== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(255, 107, 53, 0.06) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes bgFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-2%, -2%) rotate(3deg); }
}

.hero-content {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

/* ========== Card Grid ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 680px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ========== Card Component ========== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal),
                background var(--transition-normal),
                border-color var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    background: var(--color-surface-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.card:hover::before {
    opacity: 1;
}

.card-auth::before {
    background: var(--gradient-auth);
}

.card-admin::before {
    background: var(--gradient-admin);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.card-auth .card-icon {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(247, 201, 72, 0.15));
    color: #f7c948;
}

.card-admin .card-icon {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    color: #667eea;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ========== Success Card ========== */
.card-success {
    max-width: 480px;
    width: 100%;
}

.card-success::before {
    background: var(--gradient-success);
}

.card-success .card-icon {
    background: linear-gradient(135deg, rgba(67, 233, 123, 0.15), rgba(56, 249, 215, 0.15));
    color: #43e97b;
}

/* ========== Info List ========== */
.info-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-admin);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

/* ========== Form ========== */
.form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: #667eea;
}

.form-input::placeholder {
    color: var(--color-text-subtle);
}

/* ========== Alert Messages ========== */
.alert {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.alert-error {
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.2);
    color: #ff5252;
}

.alert-success {
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.2);
    color: #43e97b;
}

/* ========== Footer ========== */
.footer {
    margin-top: 3rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer p {
    font-size: 0.8rem;
    color: var(--color-text-subtle);
}

/* ========== Dashboard ========== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.dashboard-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========== Table ========== */
.table-container {
    width: 100%;
    max-width: 1100px;
    position: relative;
    z-index: 1;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.data-table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.member-id {
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* ========== Cell Stack (stacked content in a cell) ========== */
.cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cell-primary {
    font-weight: 600;
    font-size: 0.9rem;
}

.cell-secondary {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ========== Token Cell ========== */
.token-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.token-value {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.token-value-full {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    word-break: break-all;
    line-height: 1.4;
}

/* ========== Button Group Nowrap ========== */
.btn-group-nowrap {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    align-self: flex-start;
}

.badge-success {
    background: rgba(67, 233, 123, 0.12);
    color: #43e97b;
}

.badge-danger {
    background: rgba(255, 82, 82, 0.12);
    color: #ff5252;
}

/* ========== Button Group & Small Buttons ========== */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-danger {
    background: rgba(255, 82, 82, 0.15);
    color: #ff5252;
    border: 1px solid rgba(255, 82, 82, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 82, 82, 0.25);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-success {
    background: rgba(67, 233, 123, 0.15);
    border: 1px solid rgba(67, 233, 123, 0.3);
    color: #43e97b;
    backdrop-filter: blur(10px);
}

.toast-error {
    background: rgba(255, 82, 82, 0.15);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: #ff5252;
    backdrop-filter: blur(10px);
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
    .hero {
        padding: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.5rem;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
