/* ============================================
   CRGEN CRM - Light Professional Theme
   Single Theme Design System
   ============================================ */

:root {
    /* Primary - Indigo */
    --primary-50: #EEF2FF;
    --primary-100: #E0E7FF;
    --primary-200: #C7D2FE;
    --primary-300: #A5B4FC;
    --primary-400: #818CF8;
    --primary-500: #6366F1;
    --primary-600: #4F46E5;
    --primary-700: #4338CA;
    --primary-800: #3730A3;
    --primary-900: #312E81;

    /* Backgrounds - Clean White */
    --bg-app: #F8F9FC;
    --bg-sidebar: #FFFFFF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F1F5F9;
    --bg-tertiary: #E8ECF1;
    --bg-input: #FFFFFF;
    --bg-hover: rgba(99, 102, 241, 0.06);

    /* Text - Dark Slate */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --text-disabled: #CBD5E1;
    --text-inverse: #FFFFFF;

    /* Borders */
    --border-primary: #E2E8F0;
    --border-secondary: #CBD5E1;
    --border-focus: #6366F1;
    --border-color: #E2E8F0;
    --border-color-dark: #CBD5E1;

    /* Semantic Colors */
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --success-border: rgba(5, 150, 105, 0.2);
    --success-light: rgba(5, 150, 105, 0.12);

    --warning: #D97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --warning-border: rgba(217, 119, 6, 0.2);
    --warning-light: rgba(217, 119, 6, 0.12);

    --danger: #DC2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --danger-border: rgba(220, 38, 38, 0.2);
    --danger-light: rgba(220, 38, 38, 0.12);

    --info: #2563EB;
    --info-bg: rgba(37, 99, 235, 0.08);
    --info-border: rgba(37, 99, 235, 0.2);
    --info-light: rgba(37, 99, 235, 0.12);

    /* Slate */
    --slate-50: rgba(100, 116, 139, 0.04);
    --slate-100: rgba(100, 116, 139, 0.08);
    --slate-200: rgba(100, 116, 139, 0.12);
    --slate-300: rgba(100, 116, 139, 0.2);
    --slate-400: rgba(100, 116, 139, 0.3);
    --slate-500: #64748B;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1E293B;
    --slate-900: #0F172A;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-toast: 1060;
}

/* ============================================
   Reset & Base
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-app);
    overflow-x: hidden;
    overflow-y: scroll; /* Scrollbar her zaman gorunur - sayfa kaymasi onlenir */
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================
   Layout
   ============================================ */
.app-layout { display: flex; min-height: 100vh; background: var(--bg-app); }

/* Sidebar */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-primary);
    box-shadow: 1px 0 0 var(--border-primary);
    display: flex; flex-direction: column;
    z-index: var(--z-fixed);
    transition: transform var(--transition-slow), visibility var(--transition-slow);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex; align-items: center;
    padding: 0 var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-logo {
    font-size: 22px; font-weight: 700;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; letter-spacing: -0.5px;
}

.sidebar-nav { flex: 1; padding: var(--space-lg) 0; overflow-y: auto; }

.nav-section { margin-bottom: var(--space-xl); }
.nav-section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text-tertiary);
    padding: 0 var(--space-lg); margin-bottom: var(--space-md);
}

.nav-item {
    display: flex; align-items: center;
    padding: 11px var(--space-lg); margin: 0 var(--space-sm);
    color: #475569; text-decoration: none;
    transition: all var(--transition-fast);
    position: relative; font-weight: 500;
    border-radius: var(--radius-sm); font-size: 14px;
}
.nav-item:hover { background: #F1F5F9; color: #1E293B; }
.nav-item.active { background: #EEF2FF; color: #4F46E5; }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: #4F46E5; border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 20px; height: 20px; margin-right: var(--space-md);
    display: flex; align-items: center; justify-content: center;
}

.nav-badge {
    margin-left: auto; background: var(--danger); color: white;
    font-size: 11px; font-weight: 600; padding: 2px 7px;
    border-radius: var(--radius-full); min-width: 20px; text-align: center;
}

/* Main Content */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    display: flex; flex-direction: column; min-height: 100vh;
    background: var(--bg-app);
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: #FFFFFF; border-bottom: 1px solid var(--border-primary);
    box-shadow: 0 1px 0 var(--border-primary);
    display: flex; align-items: center;
    padding: 0 var(--space-xl);
    position: sticky; top: 0; z-index: var(--z-sticky);
    gap: var(--space-lg);
}

.topbar-left { display: flex; align-items: center; gap: var(--space-md); }

.mobile-menu-btn {
    display: none; background: none; border: none;
    font-size: 24px; color: var(--text-secondary);
    cursor: pointer; padding: var(--space-sm);
    border-radius: var(--radius-sm);
}
.mobile-menu-btn:hover { background: #F1F5F9; color: #1E293B; }

.topbar-search { position: relative; width: 360px; }
.topbar-search input {
    width: 100%; height: 40px; padding: 0 var(--space-md) 0 40px;
    background: #F1F5F9; border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary);
}
.topbar-search input::placeholder { color: var(--text-tertiary); }
.topbar-search input:focus {
    outline: none; background: #FFFFFF;
    border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.topbar-search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); font-size: 18px;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-sm); }

.topbar-btn {
    position: relative; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: var(--radius-sm);
    color: #64748B; cursor: pointer;
}
.topbar-btn:hover { background: #F1F5F9; color: #1E293B; }
.topbar-btn .badge,
.topbar-badge {
    position: absolute; top: 6px; right: 6px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--danger); color: white;
    border: 2px solid var(--bg-primary); border-radius: 10px;
    font-size: 10px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}

/* Notification Dropdown */
.notification-dropdown-wrapper { position: relative; }
.notification-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 8px;
    width: 360px; max-height: 480px;
    background: var(--bg-primary); border: 1px solid var(--border-primary);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    z-index: 1000; display: none;
    overflow: hidden;
}
.notification-dropdown.open { display: block; }
.notification-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}
.notification-header h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0; }
.notification-mark-all {
    background: none; border: none; color: var(--primary-600);
    font-size: 12px; cursor: pointer; padding: 0;
}
.notification-mark-all:hover { text-decoration: underline; }
.notification-list { max-height: 340px; overflow-y: auto; }
.notification-item {
    display: flex; gap: 12px; padding: 14px 16px;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer; transition: background 0.15s;
}
.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: rgba(91, 103, 245, 0.05); }
.notification-item.unread:hover { background: rgba(91, 103, 245, 0.1); }
.notification-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 16px;
}
.notification-icon.primary { background: rgba(91, 103, 245, 0.15); color: var(--primary-600); }
.notification-icon.success { background: var(--success-bg); color: var(--success); }
.notification-icon.warning { background: var(--warning-bg); color: var(--warning); }
.notification-icon.danger { background: var(--danger-bg); color: var(--danger); }
.notification-icon.info { background: var(--info-bg); color: var(--info); }
.notification-icon.secondary { background: var(--slate-100); color: var(--text-secondary); }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notification-message { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notification-time { font-size: 11px; color: var(--text-tertiary); }
.notification-footer {
    padding: 12px 16px; text-align: center;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}
.notification-footer a { color: var(--primary-600); font-size: 13px; text-decoration: none; font-weight: 500; }
.notification-footer a:hover { text-decoration: underline; }
.notification-empty, .notification-loading {
    padding: 40px 20px; text-align: center;
    color: var(--text-tertiary); font-size: 14px;
}

/* Notification Pulse Animation */
@keyframes notificationPulse {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.3) rotate(-10deg); }
    20% { transform: scale(1) rotate(10deg); }
    30% { transform: scale(1.3) rotate(-10deg); }
    40% { transform: scale(1) rotate(10deg); }
    50% { transform: scale(1.3) rotate(-10deg); }
    60% { transform: scale(1) rotate(0deg); }
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    50% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
.topbar-notifications.notification-pulse {
    animation: notificationPulse 0.8s ease-in-out 3;
}
.topbar-notifications.notification-pulse .icon-bell {
    color: var(--danger);
}
.notification-badge-pulse {
    animation: badgePulse 0.6s ease-in-out infinite;
}

.user-menu {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm); cursor: pointer;
    margin-left: var(--space-sm);
}
.user-menu:hover { background: #F1F5F9; }

.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; border: 2px solid var(--border-primary);
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 600; color: #1E293B; line-height: 1.3; }
.user-role { font-size: 12px; color: var(--text-tertiary); line-height: 1.3; }

/* Page Content */
.page-content { flex: 1; padding: var(--space-xl); max-width: 1600px; width: 100%; margin: 0 auto; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 var(--space-xl); }
.container h1 { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-xl); }

/* Page Header */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: var(--space-xl); flex-wrap: wrap; gap: var(--space-md);
}
.page-header > div:first-child { flex: 1; }
.page-title { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-xs); letter-spacing: -0.5px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); }
.page-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

/* Sidebar Overlay — base styles in crm-components.css */

/* Sidebar close button (mobile only) */
.sidebar-close-btn { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%); width: 280px; box-shadow: none;
        visibility: hidden; pointer-events: none;
    }
    .sidebar.open {
        transform: translateX(0); box-shadow: var(--shadow-xl);
        visibility: visible; pointer-events: auto;
    }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .topbar { padding: 0 var(--space-md); }
    .topbar-search { display: none; }
    .user-info { display: none; }
    .page-content { padding: var(--space-md); }
    .sidebar-close-btn {
        display: flex; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
        width: 36px; height: 36px; border: none; background: #F1F5F9;
        color: #64748B; border-radius: 50%; font-size: 18px; cursor: pointer;
        align-items: center; justify-content: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; }
    .page-content { padding: var(--space-lg); }
}
