/* ===================================
   CLOWNTERS PANEL - DESIGN SYSTEM
   Premium Dark Theme with Glassmorphism
   =================================== */

/* CSS Variables */
:root {
    /* Colors */
    --bg-primary: #08080c;
    --bg-secondary: #0f0f15;
    --bg-tertiary: #16161f;
    --bg-quaternary: #1e1e2a;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --accent-glow: rgba(99, 102, 241, 0.4);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    /* Status */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(167, 139, 250, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-quaternary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===================================
   SIDEBAR
   =================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal), width var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--glass-bg);
    color: var(--accent-tertiary);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-status {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ===================================
   MAIN CONTENT
   =================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: var(--glass-blur);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

.header-title {
    flex: 1;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.header-title p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--success-bg);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Content Wrapper */
.content-wrapper {
    padding: 24px;
    max-width: 1200px;
}

/* ===================================
   MODULES
   =================================== */
.module-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.module {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.3s ease;
}

.module.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   CARDS
   =================================== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    font-size: 0.95rem;
}

.card-header svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.card-header .btn-icon {
    margin-left: auto;
}

.card-body {
    padding: 20px;
}

/* ===================================
   FORM ELEMENTS
   =================================== */
.input-group {
    display: flex;
    gap: 12px;
}

.input-field {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 14px 18px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-small {
    width: 100px;
    flex: none;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
    margin-top: 16px;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Select */
.select-field {
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 150px;
}

.select-field:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.select-field option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* Options Group */
.options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-group label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===================================
   ALERTS
   =================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-info {
    background: var(--info-bg);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

/* ===================================
   RESULTS
   =================================== */
.result-card {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table tr {
    border-bottom: 1px solid var(--glass-border);
}

.result-table tr:last-child {
    border-bottom: none;
}

.result-table td {
    padding: 10px 0;
}

.result-table td:first-child {
    color: var(--text-tertiary);
    font-weight: 500;
    width: 140px;
}

.result-table td:last-child {
    color: var(--text-primary);
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--glass-border);
}

.result-item-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-tertiary);
    font-size: 0.95rem;
}

.result-item .btn-icon {
    width: 32px;
    height: 32px;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-badge.valid {
    background: var(--success-bg);
    color: var(--success);
}

.result-badge.invalid {
    background: var(--error-bg);
    color: var(--error);
}

.result-badge svg {
    width: 14px;
    height: 14px;
}

/* Person Card */
.person-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.person-field {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--glass-border);
}

.person-field-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.person-field-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

/* Credit Card Display */
.credit-card {
    width: 320px;
    height: 190px;
    background: var(--accent-gradient);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.credit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.credit-card-chip {
    width: 45px;
    height: 35px;
    background: linear-gradient(135deg, #ffd700, #ffec8b);
    border-radius: 6px;
}

.credit-card-number {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.credit-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.credit-card-info {
    display: flex;
    flex-direction: column;
}

.credit-card-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.7;
}

.credit-card-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.credit-card-brand {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* ===================================
   LOADING
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 8, 12, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-quaternary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1001;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--info);
}

.toast svg {
    width: 20px;
    height: 20px;
}

.toast.success svg {
    color: var(--success);
}

.toast.error svg {
    color: var(--error);
}

.toast.info svg {
    color: var(--info);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .content-wrapper {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0 16px;
    }

    .header-title h1 {
        font-size: 1rem;
    }

    .header-title p {
        display: none;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .options-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .person-card {
        grid-template-columns: 1fr;
    }

    .credit-card {
        width: 100%;
        max-width: 320px;
    }

    .result-table td:first-child {
        width: 100px;
        font-size: 0.75rem;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        min-width: auto;
    }
}

/* Mobile Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* ===================================
   API KEY MODAL
   =================================== */
.api-key-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 8, 12, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.2s ease;
}

.api-key-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 450px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.api-key-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
}

.api-key-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.api-key-modal-body {
    padding: 20px;
}

.api-key-modal-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Toast warning style */
.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.warning svg {
    color: var(--warning);
}