/* ============================================
   AlbIM Design System — Albayrak Demir Celik
   ============================================ */

/* --- CSS Custom Properties (Archival Echo) --- */
:root {
    /* Brand Colors — Action Teal & Archival Ink */
    --brand-primary: #00897B;
    /* Action Teal */
    --brand-primary-hover: #00695C;
    --brand-primary-light: #4DB6AC;
    --brand-accent: #263238;
    /* Ink Black */
    --brand-accent-hover: #10181b;

    /* Surfaces — Limestone & Fossil Gray */
    --surface-bg: #1A1C1E;
    /* Deep Charcoal instead of light limestone for standard mode */
    --surface-card: #23272A;
    --surface-card-hover: #2C2F33;
    --surface-sidebar: #1E2124;
    --surface-chat: #1A1C1E;
    --surface-input: #2C2F33;
    --surface-modal: #23272A;

    /* Text — Ghost White & Ash Gray */
    --text-primary: #ECEFF1;
    --text-secondary: #B0BEC5;
    --text-muted: #607D8B;
    --text-inverse: #1A1C1E;

    /* Borders — Etched Glass */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-active: rgba(0, 137, 123, 0.4);

    /* Feedback */
    --success: #00C853;
    --warning: #FFD600;
    --danger: #FF1744;
    --info: #00B0FF;

    /* Shadows — Deep Depth */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 56px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 137, 123, 0.15);

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

    /* Radius — Precision Precision */
    --radius-sm: 2px;
    /* Sharper edges for 'engraved' look */
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 50%;

    /* Typography — Clinical Precision */
    --font-family: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.775rem;
    --font-size-base: 0.85rem;
    --font-size-md: 0.95rem;
    --font-size-lg: 1.15rem;

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.2, 1, 0.2, 1);
    --transition-base: 400ms cubic-bezier(0.2, 1, 0.2, 1);
    --transition-smooth: 600ms cubic-bezier(0.2, 1, 0.2, 1);

    /* Message Specifics */
    --msg-sent-bg: rgba(0, 137, 123, 0.15);
    --msg-sent-text: #ECEFF1;
    --msg-received-bg: rgba(255, 255, 255, 0.05);
    --msg-received-text: #ECEFF1;
}

/* --- Light Mode Refinement: The Limestone Archive --- */
:root[data-theme="light"] {
    --surface-bg: #F4F7F6;
    /* Limestone tint */
    --surface-card: #FFFFFF;
    --surface-card-hover: #F0F4F3;
    --surface-sidebar: #E9EDEC;
    --surface-chat: #F4F7F6;
    --surface-input: #FFFFFF;
    --surface-modal: #FFFFFF;

    --text-primary: #263238;
    --text-secondary: #455A64;
    --text-muted: #90A4AE;
    --text-inverse: #FFFFFF;

    --border-subtle: rgba(38, 50, 56, 0.08);
    --border-active: rgba(0, 137, 123, 0.2);

    --shadow-sm: 0 1px 2px rgba(38, 50, 56, 0.05);
    --shadow-md: 0 4px 12px rgba(38, 50, 56, 0.08);
    --shadow-lg: 0 12px 32px rgba(38, 50, 56, 0.1);

    --msg-sent-bg: #D1E7E5;
    /* Soft Teal */
    --msg-sent-text: #1A1C1E;
    --msg-received-bg: #FFFFFF;
    --msg-received-text: #1A1C1E;
}


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

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

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

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

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

/* --- Utilities --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-xs {
    gap: var(--space-xs);
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.p-4 {
    padding: 1rem;
}

.w-full {
    width: 100%;
}

/* --- Form Elements --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.form-input:focus {
    border-color: var(--brand-primary);
    background: var(--surface-card);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 8px 18px;
    font-size: var(--font-size-sm);
    font-weight: 700;
    font-family: var(--font-family);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-primary);
    color: #FFFFFF;
    box-shadow: 0 4px 0 var(--brand-primary-hover);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 var(--brand-primary-hover);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--brand-primary-hover);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* --- Avatar --- */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    /* Square avatars for archival feel */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--font-size-xs);
    color: white;
    background: var(--brand-accent);
    flex-shrink: 0;
    position: relative;
    border: 1px solid var(--border-subtle);
}

.avatar-online::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--success);
    border: 2px solid var(--surface-sidebar);
    border-radius: var(--radius-full);
}

/* --- Card --- */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
}


/* --- Toast / Notification --- */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    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;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
    min-width: 280px;
    max-width: 400px;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-info {
    background: var(--info);
    color: white;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Animations --- */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.4s ease;
}

/* --- Spinner --- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
        --space-2xl: 32px;
    }
}