/* CONECTA360-PRO - Dashboard & Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary)
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: width var(--transition-base);
    min-width: var(--sidebar-collapsed-width);
}

.sidebar-resizer {
    position: absolute;
    right: -3px;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 100;
    transition: background-color var(--transition-fast);
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
    background-color: var(--primary-500);
}

/* Disable transitions during manual resize to avoid lag */
.sidebar.no-transition,
.main-wrapper.no-transition {
    transition: none !important;
}

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

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

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary)
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--primary-400)
}

.pro-tag {
    font-size: var(--text-xs);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: var(--space-1)
}

.sidebar.collapsed .sidebar-logo span {
    display: none
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast)
}

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

.sidebar-church-info {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border-light)
}

.church-avatar {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-lg);
    flex-shrink: 0
}

.church-details {
    overflow: hidden
}

.church-details h3 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.user-role-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    background: rgba(99, 102, 241, .2);
    color: var(--primary-400);
    border-radius: var(--radius-sm);
    margin-top: var(--space-1)
}

.sidebar.collapsed .sidebar-church-info .church-details {
    display: none
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto
}

.nav-section {
    margin-bottom: var(--space-4)
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1)
}

.sidebar.collapsed .nav-section-title {
    display: none
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative
}

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

.nav-item.active {
    background: var(--primary-500);
    color: white
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: white;
    border-radius: var(--radius-full)
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: var(--text-base);
    flex-shrink: 0
}

.nav-item span {
    white-space: nowrap
}

.sidebar.collapsed .nav-item span {
    display: none
}

.nav-item .badge {
    margin-left: auto;
    padding: var(--space-1) var(--space-2);
    font-size: 10px;
    background: var(--danger-500);
    color: white;
    border-radius: var(--radius-full)
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-3)
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    overflow: hidden
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-sm);
    flex-shrink: 0
}

.user-details {
    overflow: hidden
}

.user-details span {
    display: block;
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.user-details span:first-child {
    font-weight: var(--font-medium);
    color: var(--text-primary)
}

.user-details span:last-child {
    font-size: var(--text-xs);
    color: var(--text-muted)
}

.sidebar.collapsed .user-details {
    display: none
}

.btn-logout {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast)
}

.btn-logout:hover {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-500)
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-base)
}

.sidebar.collapsed~.main-wrapper {
    margin-left: var(--sidebar-collapsed-width)
}

/* Top Header */
.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky)
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4)
}

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2)
}

.breadcrumb-item {
    font-size: var(--text-sm);
    color: var(--text-muted)
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: var(--font-medium)
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin-left: var(--space-2);
    color: var(--text-muted)
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2)
}

.header-search {
    position: relative;
    display: flex;
    align-items: center
}

.header-search i {
    position: absolute;
    left: 12px;
    color: var(--text-muted)
}

.header-search input {
    width: 240px;
    padding: var(--space-2) var(--space-4) var(--space-2) 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast)
}

.header-search input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15)
}

.header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast)
}

.header-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-medium)
}

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

.notification-badge:empty {
    display: none
}

/* Content Area */
.content-area {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-6)
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1)
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-sm)
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6)
}

/* Charts */
.chart-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    height: 380px;
    position: relative;
    overflow: hidden;
}

.chart-container canvas {
    max-height: 100% !important;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4)
}

.chart-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary)
}

/* Widget Grid */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6)
}

.widget {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5)
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4)
}

.widget-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2)
}

.widget-title i {
    color: var(--primary-400)
}

.widget-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3)
}

.widget-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg)
}