/* Intellexa PWA - Global Styles */

:root {
    --color-bg: #050505;
    --color-surface: rgba(255, 255, 255, 0.04);
    --color-elevated: rgba(255, 255, 255, 0.06);
    --color-hover: rgba(255, 255, 255, 0.08);

    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-subtle: rgba(255, 255, 255, 0.05);
    --color-border-strong: rgba(255, 255, 255, 0.12);

    --color-text: #e0e0e0;
    --color-text-secondary: #9ca3af;
    --color-text-muted: #6b7280;

    --color-accent: #06b6d4;
    --color-accent-dim: rgba(6, 182, 212, 0.15);
    --color-accent-hover: #22d3ee;

    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --font-display: "Cormorant Garamond", Georgia, serif;
    --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", monospace;

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

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

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

html,
body {
    height: 100%;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.5rem;
}
h2 {
    font-size: 2rem;
}
h3 {
    font-size: 1.5rem;
}
h4 {
    font-size: 1.25rem;
}

h1 em,
h2 em,
h3 em {
    color: var(--color-accent);
    font-style: italic;
}

p {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

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

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

.container-sm {
    max-width: 480px;
}

.container-md {
    max-width: 720px;
}

/* Glass Card */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-elevated {
    background: var(--color-elevated);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), #3b82f6);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: var(--color-hover);
    border-color: var(--color-border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-error);
    margin-top: 0.5rem;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    background: linear-gradient(
        to bottom,
        rgba(5, 5, 5, 0.98),
        rgba(5, 5, 5, 0.9)
    );
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.nav-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-accent), #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-accent);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Page Layout */
.page {
    min-height: 100vh;
    padding-top: 64px;
}

.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 2rem 1.5rem;
}

.page-content {
    padding: 2rem 0;
}

/* Auth Pages */
.auth-container {
    width: 100%;
    max-width: 400px;
}

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

.auth-header h1 {
    margin-bottom: 0.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

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

/* Loading States */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--color-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateY(1rem);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.success,
.toast-success {
    border-color: var(--color-success);
}

.toast.error,
.toast-error {
    border-color: var(--color-error);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Utilities */
.text-center {
    text-align: center;
}
.text-muted {
    color: var(--color-text-muted);
}
.text-accent {
    color: var(--color-accent);
}
.text-error {
    color: var(--color-error);
}
.text-success {
    color: var(--color-success);
}

.mt-1 {
    margin-top: 0.5rem;
}
.mt-2 {
    margin-top: 1rem;
}
.mt-3 {
    margin-top: 1.5rem;
}
.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}
.mb-2 {
    margin-bottom: 1rem;
}
.mb-3 {
    margin-bottom: 1.5rem;
}
.mb-4 {
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    html,
    body {
        font-size: 15px;
    }

    h1 {
        font-size: 1.75rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    h3 {
        font-size: 1.25rem;
    }

    .nav {
        height: 56px;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .nav-logo {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .nav-title {
        font-size: 1.1rem;
    }

    .nav-links {
        display: none;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .nav-actions .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }

    .nav-actions .btn-ghost {
        display: none;
    }

    .page {
        padding-top: 56px;
    }

    .page-center {
        padding: 1.5rem 1rem;
        min-height: calc(100vh - 56px);
    }

    .container {
        padding: 0 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .auth-container {
        max-width: 100%;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    h2 {
        font-size: 1.25rem;
    }

    .nav-title {
        font-size: 1rem;
    }

    .btn-lg {
        width: 100%;
    }
}

/* Safe area for mobile */
@supports (padding: env(safe-area-inset-bottom)) {
    .page {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
