/* ═══════════════════════════════════════════════════════════════════
   EazX — Design System (base.css)
   Premium dark theme — refined, clean, minimal
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
    /* Background palette — deeper, richer darks */
    --bg-primary: #080b12;
    --bg-secondary: #0f1320;
    --bg-tertiary: #151a2e;
    --bg-surface: rgba(15, 19, 32, 0.85);
    --bg-glass: rgba(15, 19, 32, 0.6);
    --bg-glass-hover: rgba(21, 26, 46, 0.8);

    /* Accent palette — teal/cyan for a fresh, modern feel */
    --accent-primary: #06b6d4;
    --accent-primary-glow: rgba(6, 182, 212, 0.3);
    --accent-secondary: #22d3ee;
    --accent-tertiary: #67e8f9;
    --accent-gradient: linear-gradient(135deg, #06b6d4, #0ea5e9, #6366f1);
    --accent-gradient-hover: linear-gradient(135deg, #22d3ee, #38bdf8, #818cf8);

    /* Sent message gradient — subtle warm purple */
    --sent-gradient: linear-gradient(135deg, #6366f1, #7c3aed);
    --sent-gradient-hover: linear-gradient(135deg, #818cf8, #8b5cf6);

    /* Text palette */
    --text-primary: #e8ecf4;
    --text-secondary: #8b95a8;
    --text-tertiary: #5a6478;
    --text-muted: #3e4758;
    --text-accent: #67e8f9;

    /* Status colors */
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    --error: #f43f5e;
    --error-glow: rgba(244, 63, 94, 0.3);
    --info: #0ea5e9;

    /* Borders */
    --border-subtle: rgba(139, 149, 168, 0.08);
    --border-medium: rgba(139, 149, 168, 0.12);
    --border-accent: rgba(6, 182, 212, 0.25);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(6, 182, 212, 0.12);
    --shadow-glow-lg: 0 0 48px rgba(6, 182, 212, 0.2);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.6875rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Glassmorphism */
    --glass-blur: blur(24px);
    --glass-blur-heavy: blur(48px);
}

/* ─── CSS Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

input, textarea {
    font-family: var(--font-family);
    outline: none;
    border: none;
    background: none;
    color: var(--text-primary);
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 149, 168, 0.2);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 149, 168, 0.35);
}

/* ─── Utility Classes ────────────────────────────────────────────── */
.glass {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
}

.glass-heavy {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border: 1px solid var(--border-medium);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 28px;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-primary-glow);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient-hover);
    opacity: 0;
    transition: opacity var(--transition-base);
}

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

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 24px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

.input-field:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow), var(--shadow-glow);
    background: var(--bg-secondary);
}

/* ─── Animations ─────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.03); }
    70% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out; }
.animate-slide-up { animation: slideUp 0.4s ease-out; }
.animate-slide-down { animation: slideDown 0.4s ease-out; }
.animate-scale-in { animation: scaleIn 0.3s ease-out; }
.animate-bounce-in { animation: bounceIn 0.5s ease-out; }

/* ─── Toast / Notification ───────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    min-width: 260px;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
}

.toast-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--success);
}

.toast-error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: var(--error);
}

.toast-info {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: var(--accent-tertiary);
}

/* ─── Loading Spinner ────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ─── Badge ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-encrypted {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-offline {
    background: rgba(90, 100, 120, 0.1);
    color: var(--text-tertiary);
}

/* ─── Avatar ─────────────────────────────────────────────────────── */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
    position: relative;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-sm);
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: var(--font-size-base);
}

.avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

.status-dot.offline {
    background: var(--text-tertiary);
}

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}

.modal-overlay.active .modal {
    transform: scale(1);
    animation: scaleIn 0.3s ease-out;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--space-lg);
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --font-size-base: 0.875rem;
        --font-size-lg: 1rem;
        --font-size-xl: 1.25rem;
        --font-size-2xl: 1.5rem;
    }
}
