/**
 * Bitrix Portal Styles
 * تصميم بوابة الفريق بنمط Bitrix
 * @version 1.0.0
 */

/* ================================================
   🎨 CSS Variables
   ================================================ */
:root {
    --bitrix-dark-bg: linear-gradient(180deg, rgba(26, 26, 46, 0.98) 0%, rgba(22, 33, 62, 0.95) 100%);
    --bitrix-top-height: 60px;
    --bitrix-bottom-height: 50px;
    --bitrix-sidebar-width: 260px;
    --bitrix-sidebar-collapsed: 70px;
    --bitrix-primary: #667eea;
    --bitrix-secondary: #764ba2;
    --bitrix-text-light: rgba(255, 255, 255, 0.9);
    --bitrix-text-muted: rgba(255, 255, 255, 0.6);
    --bitrix-border: rgba(255, 255, 255, 0.1);
    --bitrix-hover: rgba(255, 255, 255, 0.1);
    --transition-speed: 0.3s;
}

/* ================================================
   📦 Portal Wrapper
   ================================================ */
.bitrix-portal-wrapper {
    position: relative;
    min-height: 100vh;
    background: #f5f7fa;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ================================================
   🔝 Top Bar
   ================================================ */
.bitrix-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--bitrix-top-height);
    background: var(--bitrix-dark-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bitrix-top-bar-left,
.bitrix-top-bar-center,
.bitrix-top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 18px;
    font-weight: 700;
}

.portal-logo i {
    font-size: 24px;
    color: var(--bitrix-primary);
}

.search-container {
    position: relative;
    width: 400px;
}

.search-container i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

.top-search-input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--bitrix-border);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all var(--transition-speed);
}

.top-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--bitrix-primary);
}

.top-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.top-bar-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.top-bar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.notification-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--bitrix-primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================================================
   📱 Sidebar
   ================================================ */
.bitrix-sidebar {
    position: fixed;
    right: 0;
    top: var(--bitrix-top-height);
    bottom: var(--bitrix-bottom-height);
    width: var(--bitrix-sidebar-width);
    background: var(--bitrix-dark-bg);
    transition: width var(--transition-speed);
    overflow: hidden;
    z-index: 900;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
}

.bitrix-sidebar.collapsed {
    width: var(--bitrix-sidebar-collapsed);
}

.sidebar-toggle {
    width: 100%;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 1px solid var(--bitrix-border);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-content {
    height: calc(100% - 50px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-group {
    margin-bottom: 20px;
}

.nav-group-label {
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--bitrix-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.bitrix-sidebar.collapsed .nav-group-label {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--bitrix-text-light);
    text-decoration: none;
    transition: all var(--transition-speed);
    position: relative;
}

.nav-link:hover {
    background: var(--bitrix-hover);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--bitrix-primary) 0%, var(--bitrix-secondary) 100%);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
}

.nav-link i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.nav-link span {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.bitrix-sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.bitrix-sidebar.collapsed .nav-link {
    justify-content: center;
}

/* ================================================
   📄 Main Content
   ================================================ */
.bitrix-main-content {
    margin-top: var(--bitrix-top-height);
    margin-bottom: var(--bitrix-bottom-height);
    margin-right: var(--bitrix-sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--bitrix-top-height) - var(--bitrix-bottom-height));
    background: #ffffff;
    transition: margin-right var(--transition-speed);
}

.bitrix-sidebar.collapsed ~ .bitrix-main-content {
    margin-right: var(--bitrix-sidebar-collapsed);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.section-header h1 i {
    color: var(--bitrix-primary);
}

.section-subtitle {
    color: #64748b;
    font-size: 14px;
    margin-top: 5px;
}

.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--bitrix-primary) 0%, var(--bitrix-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.bg-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stat-icon.bg-green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-icon.bg-orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-icon.bg-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
}

/* Dashboard Widgets */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.widget {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.widget-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-content {
    padding: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    transition: background var(--transition-speed);
}

.activity-item:hover {
    background: #f8fafc;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.activity-details {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: #64748b;
}

/* Content Placeholder */
.content-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.content-placeholder h2 {
    font-size: 24px;
    color: #1e293b;
    margin: 10px 0;
}

.content-placeholder p {
    font-size: 14px;
    color: #64748b;
}

/* ================================================
   🔻 Bottom Bar
   ================================================ */
.bitrix-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bitrix-bottom-height);
    background: var(--bitrix-dark-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.bottom-bar-left,
.bottom-bar-center,
.bottom-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-indicator.online {
    background: #10b981;
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.status-text {
    color: var(--bitrix-text-light);
    font-size: 13px;
    font-weight: 500;
}

.bottom-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.bottom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.bottom-btn i {
    font-size: 14px;
}

.version-text {
    color: var(--bitrix-text-muted);
    font-size: 12px;
}

/* ================================================
   📱 Responsive Design
   ================================================ */
@media (max-width: 1024px) {
    .bitrix-sidebar {
        width: var(--bitrix-sidebar-collapsed);
    }
    
    .bitrix-sidebar .nav-link span,
    .bitrix-sidebar .nav-group-label {
        opacity: 0;
        width: 0;
    }
    
    .bitrix-main-content {
        margin-right: var(--bitrix-sidebar-collapsed);
    }
    
    .search-container {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .bitrix-top-bar {
        padding: 0 10px;
    }
    
    .search-container {
        display: none;
    }
    
    .portal-logo .portal-title {
        display: none;
    }
    
    .bitrix-sidebar {
        transform: translateX(100%);
    }
    
    .bitrix-sidebar.show {
        transform: translateX(0);
    }
    
    .bitrix-main-content {
        margin-right: 0;
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
    
    .bottom-bar-center {
        gap: 8px;
    }
    
    .bottom-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header h1 {
        font-size: 22px;
    }
    
    .version-text {
        display: none;
    }
}
