/* ============================================
   Kaymn Design System - Unified Visual Identity
   ============================================ */

:root {
    /* ============================================
       Brand Colors - Kaymn
       ============================================ */
    --primary-green: #22c55e;
    --primary-green-light: #34d399;
    --primary-green-dark: #16a34a;
    --primary-green-darker: #15803d;
    
    /* Brand Gradients */
    --green-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --green-gradient-light: linear-gradient(135deg, #34d399 0%, #22c55e 100%);
    --green-gradient-subtle: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    --green-gradient-strong: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    
    /* ============================================
       Neutral Colors - Gray Scale
       ============================================ */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Semantic Colors */
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* ============================================
       Typography System
       ============================================ */
    --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Font Sizes */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    
    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --font-weight-black: 900;
    
    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* ============================================
       Spacing System (8px base)
       ============================================ */
    --spacing-0: 0;
    --spacing-1: 0.25rem;   /* 4px */
    --spacing-2: 0.5rem;    /* 8px */
    --spacing-3: 0.75rem;   /* 12px */
    --spacing-4: 1rem;      /* 16px */
    --spacing-5: 1.25rem;   /* 20px */
    --spacing-6: 1.5rem;    /* 24px */
    --spacing-8: 2rem;      /* 32px */
    --spacing-10: 2.5rem;   /* 40px */
    --spacing-12: 3rem;     /* 48px */
    --spacing-16: 4rem;     /* 64px */
    --spacing-20: 5rem;     /* 80px */
    --spacing-24: 6rem;     /* 96px */
    
    /* ============================================
       Border Radius
       ============================================ */
    --radius-none: 0;
    --radius-sm: 0.25rem;    /* 4px */
    --radius-md: 0.375rem;   /* 6px */
    --radius-lg: 0.5rem;     /* 8px */
    --radius-xl: 0.75rem;    /* 12px */
    --radius-2xl: 1rem;      /* 16px */
    --radius-3xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;
    
    /* ============================================
       Shadows
       ============================================ */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-green: 0 10px 15px -3px rgb(34 197 94 / 0.2), 0 4px 6px -4px rgb(34 197 94 / 0.1);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* ============================================
       Transitions & Animations
       ============================================ */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-all: all var(--transition-normal);
    
    /* ============================================
       Layout Constants
       ============================================ */
    --header-height: 70px;
    --footer-height: auto;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --content-max-width: 1400px;
    --content-padding: var(--spacing-6);
    
    /* ============================================
       Z-Index Scale
       ============================================ */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--gray-800);
    background: var(--gray-50);
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Unified Layout Structure
   ============================================ */
.kaymn-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.kaymn-header {
    position: sticky;
    top: 0;
    z-index: var(--z-fixed);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
}

.kaymn-main {
    flex: 1;
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.kaymn-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--gray-200);
    background: var(--white);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.kaymn-content {
    flex: 1;
    min-width: 0;
    padding: var(--content-padding);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

.kaymn-footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

/* ============================================
   Responsive Breakpoints
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
        --content-padding: var(--spacing-4);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --content-padding: var(--spacing-3);
    }
    
    .kaymn-sidebar {
        position: fixed;
        right: -100%;
        top: var(--header-height);
        z-index: var(--z-modal);
        transition: right var(--transition-normal);
        box-shadow: var(--shadow-xl);
    }
    
    .kaymn-sidebar.open {
        right: 0;
    }
    
    .kaymn-content {
        width: 100%;
    }
}

/* ============================================
   Social Platform Container (Unified Layout)
   ============================================ */
.social-platform-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr 320px;
    gap: var(--spacing-4);
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--spacing-6);
    min-height: calc(100vh - var(--header-height));
    position: relative;
    z-index: var(--z-base);
}

/* Left Sidebar Navigation - Unified */
.left-sidebar-nav {
    position: sticky;
    top: calc(var(--header-height) + var(--spacing-4));
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - var(--spacing-8));
    overflow-y: auto;
}

.sidebar-nav-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-4);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-nav-header {
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-4);
}

.sidebar-nav-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    text-decoration: none;
    color: inherit;
}

.sidebar-nav-logo .logo-icon-wrapper {
    width: 40px;
    height: 40px;
    background: var(--green-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.sidebar-nav-logo .logo-name {
    font-size: 1.25rem;
    font-weight: var(--font-weight-extrabold);
    color: var(--gray-900);
}

.sidebar-nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    flex: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    transition: var(--transition-all);
    position: relative;
}

.sidebar-nav-item i {
    width: 20px;
    text-align: center;
    font-size: var(--font-size-lg);
    color: var(--gray-600);
    transition: var(--transition-all);
}

.sidebar-nav-item:hover {
    background: var(--gray-50);
    color: var(--primary-green);
}

.sidebar-nav-item:hover i {
    color: var(--primary-green);
}

.sidebar-nav-item.active {
    background: var(--green-gradient-subtle);
    color: var(--primary-green-dark);
    border-right: 3px solid var(--primary-green);
}

.sidebar-nav-item.active i {
    color: var(--primary-green);
}

.sidebar-nav-badge {
    margin-right: auto;
    background: var(--green-gradient);
    color: var(--white);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-nav-divider {
    height: 1px;
    background: var(--gray-200);
    margin: var(--spacing-2) 0;
}

.sidebar-nav-footer {
    margin-top: auto;
    padding-top: var(--spacing-4);
    border-top: 1px solid var(--gray-200);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-3);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.sidebar-user-email {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout-form {
    width: 100%;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3);
    background: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: var(--transition-all);
}

.sidebar-logout-btn:hover {
    background: var(--gray-200);
    color: var(--error);
}

/* Main Feed */
.main-feed {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Right Sidebar */
.right-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--spacing-4));
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - var(--spacing-8));
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.sidebar-widget {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-4);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.widget-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-extrabold);
    color: var(--gray-900);
    margin-bottom: var(--spacing-4);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.suggested-users-list,
.suggested-courses-list,
.recent-activity-list,
.quick-links-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.suggested-user-item,
.suggested-course-item,
.activity-item,
.quick-link-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-all);
}

.suggested-user-item:hover,
.suggested-course-item:hover,
.quick-link-item:hover {
    background: var(--gray-50);
}

.suggested-course-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.suggested-course-info {
    flex: 1;
    min-width: 0;
}

.suggested-course-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--gray-900);
    margin-bottom: var(--spacing-1);
}

.suggested-course-meta {
    display: flex;
    gap: var(--spacing-3);
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.quick-link-item i {
    width: 20px;
    text-align: center;
    color: var(--gray-500);
}

/* Responsive adjustments for social-platform-container */
@media (max-width: 1024px) {
    .social-platform-container {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .social-platform-container {
        grid-template-columns: 1fr;
        padding: var(--spacing-3);
        gap: var(--spacing-3);
    }
    
    .left-sidebar-nav {
        display: none;
    }
}

