/* ═══════════════════════════════════════════════════════════════════════════
   COMMON STYLES - Design System & Shared Layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Design Tokens) ───────────────────────────────────────── */
:root {
    /* Color Palette */
    --bg-primary: #0f0f14;
    --bg-secondary: #16161d;
    --bg-tertiary: #1c1c26;
    --bg-card: #1e1e2a;
    --bg-hover: #252535;
    --bg-input: #1a1a25;

    --text-primary: #e8e8ed;
    --text-secondary: #9898a6;
    --text-muted: #6b6b7b;

    --accent-primary: #6c63ff;
    --accent-primary-hover: #7b73ff;
    --accent-secondary: #00d2a0;
    --accent-warning: #ff9f43;
    --accent-danger: #ff6b6b;
    --accent-info: #54a0ff;

    --gradient-primary: linear-gradient(135deg, #6c63ff 0%, #00d2a0 100%);
    --gradient-card: linear-gradient(145deg, #1e1e2a 0%, #16161d 100%);
    --gradient-glow: radial-gradient(circle at 50% 0%, rgba(108, 99, 255, 0.1) 0%, transparent 60%);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(108, 99, 255, 0.4);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.15);

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

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::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: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea {
    font-family: inherit;
    border: none;
    outline: none;
    background: none;
}

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

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

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-slow);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.4));
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 4px;
    transition: color var(--transition-fast);
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(108, 99, 255, 0.12);
    color: var(--accent-primary);
}

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-new-chat,
.btn-logout {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-new-chat {
    background: var(--gradient-primary);
    color: #fff;
}

.btn-new-chat:hover {
    opacity: 0.9;
    box-shadow: var(--shadow-glow);
}

.btn-logout {
    background: rgba(255, 107, 107, 0.1);
    color: var(--accent-danger);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-logout:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* ─── Sidebar Kullanıcı Bilgisi ──────────────────────────────────────────── */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.user-avatar {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.user-role-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.user-role-badge.role-admin {
    background: rgba(108, 99, 255, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(108, 99, 255, 0.25);
}

.user-role-badge.role-user {
    background: rgba(0, 210, 160, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(0, 210, 160, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    position: relative;
    background: var(--bg-primary);
    background-image: var(--gradient-glow);
}

/* ─── Top Bar ─────────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 15, 20, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
    gap: 16px;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
}

.hamburger span {
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions {
    margin-left: auto;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    background: rgba(0, 210, 160, 0.08);
    color: var(--accent-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    animation: pulse 2s infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-close {
        display: block;
    }

    .hamburger {
        display: flex;
    }
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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