/**
 * Bitrix-Style Layout
 * التصميم الجديد بنمط Bitrix
 * 
 * المكونات:
 * 1. الشريط العلوي الداكن (Top Bar)
 * 2. الشريط الجانبي القابل للطي (Sidebar)
 * 3. المحتوى الرئيسي (Main Content)
 * 4. الشريط السفلي الداكن (Bottom Bar)
 */

/* ================================================
   🔝 الشريط العلوي الداكن - Top Bar
   ================================================ */
.tp-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tp-top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tp-logo-compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.tp-logo-text {
    color: white;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.tp-top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tp-icon-btn:active {
    transform: translateY(0);
}

.tp-icon-btn i {
    font-size: 16px;
}

.tp-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Notification Badge في الشريط العلوي */
.tp-icon-btn .notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(245, 87, 108, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.tp-icon-btn .icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(250, 112, 154, 0.4);
}

/* ================================================
   📱 الشريط الجانبي - Sidebar
   ================================================ */
.team-portal-shell {
    display: flex;
    min-height: calc(100vh - 100px);
    margin-top: 50px;
    margin-bottom: 50px;
    position: relative;
}

.tp-bitrix-sidebar {
    position: fixed;
    top: 50px;
    right: 0;
    bottom: 50px;
    width: 240px;
    background: linear-gradient(180deg, #1e2a3a 0%, #1a1f2e 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 900;
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.2);
}

.tp-bitrix-sidebar.is-collapsed {
    width: 60px;
}

.tp-bitrix-sidebar.is-collapsed .tp-sidebar-branding .tp-sidebar-meta,
.tp-bitrix-sidebar.is-collapsed .tp-sidebar-search,
.tp-bitrix-sidebar.is-collapsed .tp-sidebar-group-label,
.tp-bitrix-sidebar.is-collapsed .tp-link-text,
.tp-bitrix-sidebar.is-collapsed .tp-sidebar-footer-btn span {
    opacity: 0;
    visibility: hidden;
}

.tp-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tp-sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.tp-sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.tp-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.tp-sidebar-toggle i {
    transition: transform 0.3s ease;
}

.tp-bitrix-sidebar.is-collapsed .tp-sidebar-toggle i {
    transform: rotate(180deg);
}

.tp-sidebar-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.tp-sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tp-logo-initials {
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.tp-sidebar-meta {
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-sidebar-title {
    color: white;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.tp-sidebar-plan {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    line-height: 1.2;
}

.tp-sidebar-search {
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-sidebar-search i {
    position: absolute;
    left: 28px;
    top: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
}

.tp-sidebar-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

.tp-sidebar-search input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
}

.tp-sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.tp-sidebar-groups {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

.tp-sidebar-group {
    margin-bottom: 8px;
}

.tp-sidebar-group-label {
    display: block;
    padding: 12px 16px 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-sidebar-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-align: right;
    transition: all 0.2s ease;
    position: relative;
}

.tp-sidebar-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tp-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.tp-sidebar-link:hover::before {
    opacity: 0.7;
}

.tp-sidebar-link.active {
    background: rgba(102, 126, 234, 0.15);
    color: white;
}

.tp-sidebar-link.active::before {
    opacity: 1;
}

.tp-link-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tp-sidebar-link:hover .tp-link-icon {
    background: rgba(255, 255, 255, 0.1);
}

.tp-sidebar-link.active .tp-link-icon {
    background: rgba(102, 126, 234, 0.2);
}

.tp-link-icon i {
    font-size: 16px;
}

.tp-link-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-link-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 2px;
}

.tp-link-subtitle {
    font-size: 11px;
    opacity: 0.6;
    line-height: 1.2;
}

.tp-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-sidebar-footer-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-align: right;
    transition: all 0.2s ease;
}

.tp-sidebar-footer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.tp-sidebar-footer-btn i {
    font-size: 14px;
}

.tp-sidebar-footer-btn span {
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-footer-badge {
    margin-right: auto;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ================================================
   📄 المحتوى الرئيسي - Main Content
   ================================================ */
.team-portal-main {
    flex: 1;
    margin-right: 240px;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
    background: #ffffff;
}

.tp-bitrix-sidebar.is-collapsed + .team-portal-main {
    margin-right: 60px;
}

.team-portal-container {
    max-width: 100%;
    margin: 0 auto;
}

/* ================================================
   🔽 الشريط السفلي الداكن - Bottom Bar
   ================================================ */
.dark-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.bottom-bar-content {
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bottom-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bottom-bar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.bottom-bar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.bottom-bar-btn i {
    font-size: 14px;
}

.bottom-bar-btn.color-red {
    border-color: rgba(245, 87, 108, 0.3);
}

.bottom-bar-btn.color-red:hover {
    background: rgba(245, 87, 108, 0.15);
    border-color: rgba(245, 87, 108, 0.5);
}

.bottom-bar-btn.color-amber {
    border-color: rgba(255, 193, 7, 0.3);
}

.bottom-bar-btn.color-amber:hover {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.5);
}

.bottom-bar-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.bottom-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ================================================
   📱 Responsive Design
   ================================================ */
@media (max-width: 768px) {
    .tp-top-bar {
        padding: 0 12px;
    }
    
    .tp-logo-text {
        display: none;
    }
    
    .tp-icon-btn {
        width: 32px;
        height: 32px;
    }
    
    .tp-bitrix-sidebar {
        width: 200px;
    }
    
    .tp-bitrix-sidebar.is-collapsed {
        width: 60px;
    }
    
    .team-portal-main {
        margin-right: 200px;
        padding: 12px;
    }
    
    .tp-bitrix-sidebar.is-collapsed + .team-portal-main {
        margin-right: 60px;
    }
    
    .bottom-bar-btn .btn-label {
        display: none;
    }
    
    .bottom-bar-status {
        display: none;
    }
}

@media (max-width: 480px) {
    .tp-bitrix-sidebar {
        transform: translateX(100%);
    }
    
    .tp-bitrix-sidebar:not(.is-collapsed) {
        transform: translateX(0);
    }
    
    .team-portal-main {
        margin-right: 0;
    }
}

/* ================================================
   🎨 Dark Mode Support
   ================================================ */
[data-theme="dark"] .team-portal-main {
    background: #0d1117;
}

[data-theme="dark"] .tp-top-bar,
[data-theme="dark"] .dark-bottom-bar {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

[data-theme="dark"] .tp-bitrix-sidebar {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
}

/* ================================================
   ✨ Animations
   ================================================ */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Scrollbar Styling */
.tp-sidebar-groups::-webkit-scrollbar {
    width: 6px;
}

.tp-sidebar-groups::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.tp-sidebar-groups::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.tp-sidebar-groups::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
