/*
*
* STEMix Academy - NexLink Soft UI (RTL Precision)
* Optimized for Right-Aligned Sidebar & Mirror Layout
*
*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Cairo:wght@400;500;600;700&display=swap');

:root {
    --primary: #3A57E8;
    --primary-hover: #2F46C3;
    --primary-light: rgba(58, 87, 232, 0.08);
    --bg-base: #F5F7FB;
    --sidebar-bg: #FFFFFF;
    --white: #FFFFFF;
    --text-main: #232D42;
    --text-muted: #8A92A6;
    --border-color: #ECEEF2;
    
    --sidebar-width: 280px;
    --header-height: 80px;
    
    --shadow-soft: 0 10px 30px 0 rgba(0, 0, 0, 0.05);
    --radius-pill: 50px;
    --radius-lg: 20px;
    --radius-md: 12px;
}

html[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
    margin: 0;
    overflow-x: hidden;
}

.portal-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* 
 * 📌 SIDEBAR (Right Aligned - Fixed)
 */
.portal-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0 !important;
    right: auto !important;
    z-index: 1200;
    box-shadow: var(--shadow-soft);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.sidebar-nav .nav-link {
    color: var(--text-muted) !important;
    padding: 0.85rem 1.25rem !important;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none !important;
}

/* RTL Icon Spacing & Flow */
.nav-link-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.sidebar-nav .nav-link i.nav-icon {
    margin-right: 15px; /* Space on right of icon to push text to right */
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: color 0.3s;
}

.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active {
    background: var(--primary-light);
    color: var(--primary) !important;
}

.sidebar-nav .nav-link:hover i.nav-icon, .sidebar-nav .nav-link.active i.nav-icon {
    color: var(--primary);
}

/* Submenu Arrow Logic */
.nav-link[data-bs-toggle="collapse"]::after {
    content: "\f105"; /* FontAwesome Angle Right */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: auto; /* Push to the opposite side (Right in LTR) */
    transition: transform 0.3s;
    font-size: 0.8rem;
    transform: rotate(0deg); /* Normal for LTR */
}

.nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
    transform: rotate(90deg);
}

/* Submenu Indentation (Unified) */
.submenu-items {
    list-style: none;
    padding-left: 3.5rem; /* Increased for better nesting visual */
    padding-right: 0;
    margin: 0.25rem 0 0.75rem;
}

.submenu-item {
    position: relative;
}

.submenu-item::before {
    content: "";
    position: absolute;
    left: -1.25rem;
    top: 50%;
    width: 6px;
    height: 6px;
    background: var(--border-color);
    border-radius: 50%;
    transform: translateY(-50%);
}

.submenu-item.active::before {
    background: var(--primary);
}

.submenu-item a {
    color: var(--text-muted);
    padding: 0.5rem 0;
    display: block;
    font-size: 0.88rem;
    text-decoration: none !important;
    transition: all 0.2s;
    font-weight: 500;
}

.submenu-item a:hover, .submenu-item.active a {
    color: var(--primary);
    transform: translateX(5px);
}

/* Fix for Dark Mode Submenu */
body.dark-mode .submenu-item a { color: var(--text-muted) !important; }
body.dark-mode .submenu-item.active a, body.dark-mode .submenu-item a:hover { color: var(--primary) !important; }
body.dark-mode .submenu-item::before { background: var(--border-color); }
body.dark-mode .submenu-item.active::before { background: var(--primary); }

/* 
 * 🌟 TOPBAR & CONTENT (Pushed to Left)
 */
.portal-main {
    flex: 1;
    margin-left: var(--sidebar-width); /* Space for fixed sidebar */
    margin-right: 0 !important;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
}

.portal-header {
    height: 75px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 1.5rem;
    z-index: 1000;
}

/* Search Bar (RTL Optimized) */
.header-search { flex: 1; max-width: 400px; }
.header-search .input-group {
    background: #F1F4F9;
    border-radius: var(--radius-pill);
    padding: 2px 15px;
    border: 1px solid transparent;
}

/* Action Icons */
.action-btn {
    width: 42px; height: 42px;
    background: #F1F4F9;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    text-decoration: none !important;
    transition: all 0.2s;
}
.action-btn:hover { background: var(--primary-light); color: var(--primary); transform: translateY(-2px); }

/* Profile Mirroring */
.user-profile {
    display: flex;
    align-items: center;
    background: #F1F4F9;
    padding: 6px 18px 6px 6px; /* Avatar on Left, Text on Right */
    border-radius: 14px;
    text-decoration: none !important;
    color: var(--text-main) !important;
    font-weight: 700;
    font-size: 0.85rem;
}

.avatar-circle {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    margin-right: 12px; /* Push text to right */
    font-weight: 800;
}

/* 
 * 📊 CARD & UI COMPONENTS
 */
.card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #fff;
    transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.08); }

.btn-primary {
    background: var(--primary);
    border-radius: 12px;
    padding: 0.8rem 1.8rem;
    box-shadow: 0 8px 20px rgba(58, 87, 232, 0.25);
    border: none;
    font-weight: 700;
}
.btn-primary:hover { transform: translateY(-2px); background: var(--primary-hover); }

/* 
 * 📱 MOBILE RESPONSIVE
 */
@media (max-width: 1024px) {
    .portal-sidebar { 
        transform: translateX(-100%); 
        left: 0 !important;
        right: auto !important;
    }
    .portal-main { 
        margin-left: 0 !important; 
        padding: 1rem; 
        width: 100%;
    }
    .portal-header { top: 0; border-radius: 0; margin-bottom: 1.5rem; padding: 0 1rem; }
    
    .sidebar-active .portal-sidebar { transform: translateX(0); }
}

/* End of file */
