/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.logo {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(107, 115, 255, 0.5);
}

/* Login Page Layout */
.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* Above the background */
    padding: 2rem;
}

.login-card {
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(107, 115, 255, 0.3);
}

.login-subtitle {
    color: var(--light-gray);
    font-size: 1rem;
}

/* Background Canvas - Fixed behind everything */
#backgroundCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Dashboard Layout */
.dashboard {
    position: relative;
    z-index: 10;
    height: 100vh;
    overflow: hidden;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.dashboard.active {
    display: block;
}

.dashboard-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}


.dashboard-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

#userEmail {
    color: var(--white);
    font-size: 0.9rem;
}

.logout-btn {
    background: var(--error);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #e74c3c;
    transform: translateY(-1px);
}

/* Dashboard Grid - 4 cards layout */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    overflow: hidden;
    align-content: center;
}

/* Dashboard Cards - Consistent sizing for 4 cards */
.dashboard-card {
    background: var(--dark-gray);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 160px;
    max-height: 200px;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.card-description {
    color: var(--light-gray);
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard {
        padding: 0.75rem;
    }
    
    .dashboard-grid {
        gap: 1rem;
    }
    
    .dashboard-card {
        min-height: 140px;
        max-height: 180px;
        padding: 1.25rem;
    }
    
    .dashboard-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 0.5rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        overflow-y: auto;
        padding-right: 0.5rem;
    }
    
    .dashboard-card {
        min-height: 120px;
        max-height: 150px;
        padding: 1rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: 0.25rem;
    }
    
    .dashboard-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    .dashboard-grid {
        gap: 0.75rem;
    }
    
    .dashboard-card {
        min-height: 100px;
        max-height: 130px;
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-description {
        font-size: 0.8rem;
    }
}

/* Hide scrollbars but keep functionality */
.dashboard-grid::-webkit-scrollbar {
    width: 4px;
}

.dashboard-grid::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-grid::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 2px;
}

.dashboard-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Page Layout */
.statistics-page,
.connections-page,
.mobile-app-page {
    display: none;
    padding: 2rem;
}

.statistics-page.active,
.connections-page.active,
.mobile-app-page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}

.page-title {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--primary);
}

/* Statistics Page Layout */
.stats-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--dark-gray);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--input-border);
    margin-bottom: 2rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 1rem;
}

/* Mobile App Page Layout */
.mobile-app-page {
    text-align: center;
}

.app-preview {
    max-width: 300px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--dark-gray);
    border-radius: 20px;
    border: 1px solid var(--input-border);
}

.download-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* Flexbox Utilities */
.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.flex-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

/* Spacing Utilities */
.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }