/* ==========================================================================
   AlphaDubai Premium Design System
   Theme: Galactic Dark (Glassmorphism, Neon Glows, Smooth Transitions)
   ========================================================================== */

/* Variables & Reset */
:root {
    --bg-primary: #0a0d1a;
    --bg-secondary: #121629;
    --bg-card: rgba(20, 26, 48, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-primary: #6366f1; /* Indigo */
    --color-primary-glow: rgba(99, 102, 241, 0.35);
    --color-secondary: #ec4899; /* Pink */
    --color-secondary-glow: rgba(236, 72, 153, 0.35);
    --color-success: #10b981; /* Emerald */
    --color-success-glow: rgba(16, 185, 129, 0.25);
    --color-danger: #ef4444; /* Rose */
    
    --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--color-secondary);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.grid { display: grid; }

/* Grid columns helper */
.grid-cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-normal);
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 14px 0 var(--color-primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, var(--color-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

.btn-success:hover {
    background: var(--color-success);
    color: white;
    transform: translateY(-2px);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(10, 13, 26, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

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

/* Navigation bar */
.navbar {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 0;
    background: rgba(10, 13, 26, 0.7);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #a5b4fc 0%, var(--color-primary) 50%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

/* Landing Page (Welcome) Hero Section */
.hero {
    padding: 7rem 0 5rem 0;
    text-align: center;
    position: relative;
}

.hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(40px);
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
}

/* Landing page features */
.features-section {
    padding: 5rem 0;
}

.features-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.2rem;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Authentication pages layout */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.auth-card {
    width: 100%;
    max-width: 450px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Alerts and errors */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.validation-errors {
    list-style: none;
    margin-left: 1rem;
}

/* Backend (Dashboard) layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: #0d1122;
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-brand {
    margin-bottom: 3rem;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-link:hover, .sidebar-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--color-primary);
}

.sidebar-user {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    overflow: hidden;
}

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

.user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Dashboard main content */
.main-content {
    padding: 3rem;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

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

/* Stats Widget Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.15); color: var(--color-primary); }
.stat-icon.secondary { background: rgba(236, 72, 153, 0.15); color: var(--color-secondary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    font-family: var(--font-heading);
}

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

/* Profile / Forms Cards */
.settings-form {
    max-width: 600px;
}

/* Notes Board / CRUD Grid */
.notes-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media(min-width: 900px) {
    .notes-container {
        grid-template-columns: 320px 1fr;
    }
}

.note-creator {
    align-self: flex-start;
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.note-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 220px;
    position: relative;
}

.note-card.completed {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.03);
}

.note-card.completed .note-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.note-card.completed .note-body {
    color: var(--text-muted);
}

.note-title {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.note-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.note-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: auto;
}

/* API Tokens layout */
.token-creation-box {
    margin-bottom: 2rem;
}

.token-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.token-list-table th, .token-list-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.token-list-table th {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Display newly generated token overlay */
.token-display-alert {
    background: rgba(99, 102, 241, 0.15);
    border: 1px dashed var(--color-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.token-box {
    background: #060810;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1rem;
    color: #a5b4fc;
    margin: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-break: break-all;
}

/* Keyframes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design adjustments */
@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* In a real production app we'd have a toggle menu, we'll make a simplified header for mobile or show the sidebar below/above */
    }
    .main-content {
        padding: 1.5rem;
    }
    .hero-title {
        font-size: 2.2rem;
    }
}
