/* DealGram - Sidebar with Fixed Toggle */

.sidebar-elegant {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    overflow: visible; /* Important for toggle button */
}

.dark-mode .sidebar-elegant {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Collapsed State */
.sidebar-elegant.collapsed {
    width: 80px;
}

/* TOGGLE BUTTON - Fixed to sidebar */
.sidebar-toggle {
    position: absolute;
    right: -16px;  /* Połowa przycisku wystaje poza sidebar */
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: white;
    border-radius: 0 12px 12px 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: none;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
}

.dark-mode .sidebar-toggle {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    border-color: transparent;
    right: -20px;
    width: 40px;
    box-shadow: 4px 0 12px rgba(20, 184, 166, 0.3);
}

.sidebar-toggle i,
.sidebar-toggle svg {
    font-size: 16px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.sidebar-toggle:hover i,
.sidebar-toggle:hover svg {
    color: white;
}

.dark-mode .sidebar-toggle i,
.dark-mode .sidebar-toggle svg {
    color: #94a3b8;
}

.sidebar-elegant.collapsed .sidebar-toggle i,
.sidebar-elegant.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Sidebar musi mieć overflow visible dla toggle buttona */
.sidebar-elegant {
    overflow: visible !important;
}

.sidebar-inner {
    height: 100%;
    overflow-y: auto;
}

/* Main content adjustment */
.sidebar-collapsed .main-content {
    margin-left: 80px !important;
}

/* Inner container */
.sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    overflow-y: auto;
}

.sidebar-elegant.collapsed .sidebar-inner {
    padding: 24px 8px;
}

/* Profile Section */
.sidebar-profile {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(6, 182, 212, 0.04));
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(20, 184, 166, 0.15);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sidebar-profile:hover {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(6, 182, 212, 0.08));
    border-color: rgba(20, 184, 166, 0.3);
}

.dark-mode .sidebar-profile {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(6, 182, 212, 0.08));
    border-color: rgba(20, 184, 166, 0.25);
}

.sidebar-elegant.collapsed .sidebar-profile {
    padding: 12px 8px;
    background: transparent;
    border: none;
}

.profile-avatar-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0;
    flex-shrink: 0;
}

.sidebar-elegant.collapsed .profile-avatar-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 22px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.3);
}

.sidebar-elegant.collapsed .profile-avatar {
    font-size: 16px;
    border-radius: 12px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border: 3px solid white;
    border-radius: 50%;
}

.sidebar-elegant.collapsed .avatar-status {
    width: 12px;
    height: 12px;
    border-width: 2px;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.profile-details h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.profile-details p {
    margin: 0;
}

.dark-mode .profile-details h4 {
    color: #f1f5f9;
}

.sidebar-elegant.collapsed .profile-details {
    display: none;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.owner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(20, 184, 166, 0.1);
    color: #0d9488;
}

.role-badge.admin {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Widgets */
.sidebar-widget {
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.dark-mode .sidebar-widget {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-elegant.collapsed .sidebar-widget {
    display: none;
}

.widget-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget-title i {
    font-size: 14px;
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.widget-title svg {
    font-size: 14px;
    color: #14b8a6;
}

/* Command Center */
.command-center {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.03));
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode .action-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.action-btn:hover {
    transform: translateX(4px);
}

.action-btn.turquoise:hover {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    border-color: transparent;
}

.action-btn.purple:hover {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-color: transparent;
}

.action-btn.orange:hover {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    border-color: transparent;
}

/* Activity Widget */
.activity-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 120px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    color: #14b8a6;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.activity-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.activity-icon.turquoise {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.activity-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.activity-info {
    flex: 1;
}

.activity-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1;
}

.dark-mode .activity-value {
    color: #f1f5f9;
}

.activity-label {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 8px;
    padding: 0 12px;
}

.sidebar-elegant.collapsed .nav-title {
    display: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #64748b;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 14px;
    margin-bottom: 2px;
    position: relative;
}

.nav-link:hover {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
    transform: translateX(4px);
}

.sidebar-elegant.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-elegant.collapsed .nav-link span {
    display: none;
}

/* Mark single notification as read button */
.notification-item {
    position: relative;
    padding-right: 40px; /* Space for button */
}

.notification-item .mark-read {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(20, 184, 166, 0.2);
    background: rgba(20, 184, 166, 0.05);
    color: #14b8a6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.notification-item .mark-read:hover {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    border-color: transparent;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.dark-mode .notification-item .mark-read {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.3);
}

.notification-item:not(.unread) .mark-read {
    display: none;
}

/* Footer */
.sidebar-footer {
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
    justify-content: center;
}

.dark-mode .sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Theme Toggle Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    color: #64748b;
}

.dark-mode .theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.theme-toggle:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

.theme-toggle .dark-icon {
    display: block;
}

.theme-toggle .light-icon {
    display: none;
}

.dark-mode .theme-toggle .dark-icon {
    display: none;
}

.dark-mode .theme-toggle .light-icon {
    display: block;
}

/* Footer buttons */
.footer-btn,
.logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #64748b;
    font-size: 16px;
}

.dark-mode .footer-btn,
.dark-mode .logout-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.footer-btn:hover {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar-elegant {
        transform: translateX(-100%);
    }
    
    .sidebar-elegant.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: none;
    }
}