/* DealGram - Base Layout Styles */

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

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ===== APP CONTAINER ===== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--navbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    z-index: var(--z-sticky);
    transition: left var(--transition-base);
}

.sidebar-collapsed .navbar {
    left: var(--sidebar-collapsed-width);
}

.navbar-container {
    height: 100%;
    padding: 0 var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-500);
}

.navbar-brand i {
    font-size: 1.5rem;
}

.navbar-menu {
    display: flex;
    gap: var(--space-xs);
    flex: 1;
    margin: 0 var(--space-xl);
}

.navbar-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.navbar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.navbar-item.active {
    color: var(--primary-500);
    background: var(--primary-100);
}

.navbar-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: var(--space-md);
    right: var(--space-md);
    height: 2px;
    background: var(--primary-500);
    border-radius: var(--radius-full);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-action {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.navbar-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle .theme-dark {
    display: none;
}

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

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

/* Notifications */
.notifications-wrapper {
    position: relative;
}

.notifications-trigger {
    position: relative;
}

.notifications-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + var(--space-sm));
    right: 0;
    width: 360px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    display: none;
    z-index: var(--z-dropdown);
}

.notifications-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.notifications-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mark-all-read {
    background: transparent;
    border: none;
    color: var(--primary-500);
    cursor: pointer;
    font-size: 0.875rem;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    transition: background var(--transition-fast);
    position: relative;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: var(--primary-50);
}

.dark-mode .notification-item.unread {
    background: rgba(59, 130, 246, 0.1);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.info {
    background: var(--info);
    color: white;
}

.notification-icon.success {
    background: var(--success);
    color: white;
}

.notification-icon.warning {
    background: var(--warning);
    color: white;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.notification-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.notification-mark-read {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-xs);
}

.notifications-footer {
    padding: var(--space-sm) var(--space-lg);
    text-align: center;
    border-top: 1px solid var(--border-light);
}

.notifications-footer a {
    color: var(--primary-500);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    z-index: var(--z-fixed);
    transition: all var(--transition-base);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-content {
    padding: var(--space-xl) var(--space-lg);
}

.sidebar.collapsed .sidebar-content {
    padding: var(--space-xl) var(--space-sm);
}

.sidebar-section {
    margin-bottom: var(--space-xl);
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
}

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

/* Plan Card */
.plan-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.plan-header {
    margin-bottom: var(--space-md);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.plan-badge.free {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #6b7280;
}

.plan-features {
    list-style: none;
    margin-bottom: var(--space-md);
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.813rem;
    color: var(--text-secondary);
}

.plan-features i {
    color: var(--success);
    font-size: 0.75rem;
}

.sidebar.collapsed .plan-card {
    display: none;
}

/* Sidebar Menu */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
}

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

/* Sidebar Toggle */
.sidebar-toggle {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 1;
}

.sidebar-toggle:hover {
    background: var(--primary-500);
    color: white;
}

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

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 280px;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;  /* pod przyciskiem toggle */
}

.sidebar-collapsed .main-content {
    margin-left: 80px;
}

/* Zapewnij że przycisk toggle jest zawsze widoczny */
.sidebar-toggle {
    position: fixed !important;
    z-index: 998 !important;
}

.content-wrapper {
    padding: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== ALERTS ===== */
.alerts-container {
    margin-bottom: var(--space-lg);
}

.alert {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.alert-close {
    margin-left: auto;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-lg);
}

.logo-svg {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--primary-500);
}

.loading-circle {
    stroke-dasharray: 176;
    stroke-dashoffset: 176;
    animation: drawCircle 2s ease-in-out infinite;
}

@keyframes drawCircle {
    0% { stroke-dashoffset: 176; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -176; }
}

.logo-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: var(--primary-500);
}

.loading-content h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.loading-dots {
    display: flex;
    gap: var(--space-xs);
    justify-content: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--primary-500);
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .navbar-brand span {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        left: 0;
    }
    
    .navbar-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: var(--space-md);
    }
    
}

/* ===== DARK MODE SPECIFIC ===== */
.dark-mode .navbar {
    background: var(--bg-primary);
    border-bottom-color: var(--border-light);
}

.dark-mode .sidebar {
    background: var(--bg-primary);
    border-right-color: var(--border-light);
}

.dark-mode .navbar-item.active {
    background: rgba(59, 130, 246, 0.1);
}

.dark-mode .plan-badge.free {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-hover));
    color: var(--text-secondary);
}