/* Layout CSS - Page layouts, grid, flex utilities */

/* ============================================
   Page Container
   ============================================ */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: hsl(var(--background-alt));
}

/* ============================================
   Main Content Area
   ============================================ */
.main {
    flex: 1;
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

.main-narrow {
    max-width: 56rem;
}

.main-wide {
    max-width: 90rem;
}

.main-full {
    max-width: none;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    margin-bottom: var(--spacing-lg);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 400;
    color: hsl(var(--foreground));
    margin: 0 0 var(--spacing-xs) 0;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    margin: 0;
}

/* Page header with actions */
.page-header-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

@media (min-width: 768px) {
    .page-header-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* ============================================
   Footer
   ============================================ */
.footer {
    padding: var(--spacing-md);
    text-align: center;
    font-size: var(--text-xs);
    color: hsl(var(--muted-foreground));
    border-top: 1px solid hsl(var(--border));
    background-color: hsl(var(--background));
}

.footer a {
    color: hsl(var(--primary));
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Two Column Layout (Login/Register pages)
   ============================================ */
.layout-split {
    display: flex;
    min-height: 100vh;
}

.layout-split-left {
    display: none;
    flex: 1;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary) / 0.8) 100%);
    color: hsl(var(--background));
    padding: var(--spacing-xl);
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .layout-split-left {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.layout-split-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    background-color: hsl(var(--background));
}

.layout-split-content {
    width: 100%;
    max-width: 28rem;
}

/* Decorative dot pattern for split layout */
.dot-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: radial-gradient(circle, currentColor 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ============================================
   Content Section
   ============================================ */
.section {
    background-color: hsl(var(--card));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.section:last-child {
    margin-bottom: 0;
}

.section-header {
    margin-bottom: var(--spacing-md);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0;
}

.section-description {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    margin: var(--spacing-xs) 0 0 0;
}

/* ============================================
   Container Utilities
   ============================================ */
.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.container-sm { max-width: 40rem; }
.container-md { max-width: 56rem; }
.container-lg { max-width: 72rem; }
.container-xl { max-width: 90rem; }

/* ============================================
   Grid Layouts
   ============================================ */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Auto-fit grid */
.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

/* ============================================
   Flex Layouts
   ============================================ */
.stack {
    display: flex;
    flex-direction: column;
}

.stack-sm { gap: var(--spacing-sm); }
.stack-md { gap: var(--spacing-md); }
.stack-lg { gap: var(--spacing-lg); }

.row {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.row-sm { gap: var(--spacing-sm); }
.row-md { gap: var(--spacing-md); }
.row-lg { gap: var(--spacing-lg); }

.row-between {
    justify-content: space-between;
}

.row-center {
    justify-content: center;
}

.row-end {
    justify-content: flex-end;
}

/* ============================================
   Separator
   ============================================ */
.separator {
    background-color: hsl(var(--border));
}

.separator-horizontal {
    height: 1px;
    width: 100%;
    margin: var(--spacing-md) 0;
}

.separator-vertical {
    width: 1px;
    height: 100%;
    margin: 0 var(--spacing-md);
}

/* ============================================
   Stats Grid (Dashboard-style)
   ============================================ */
.stats-grid {
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background-color: hsl(var(--card));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    padding: var(--spacing-lg);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.2;
}

.stat-label {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    margin-top: var(--spacing-xs);
}

/* ============================================
   Feature List (for login page)
   ============================================ */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.feature-icon svg,
.feature-icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.feature-content {
    flex: 1;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.feature-description {
    font-size: var(--text-sm);
    opacity: 0.9;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin-bottom: var(--spacing-md);
    color: hsl(var(--muted-foreground) / 0.5);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: var(--spacing-xs);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    max-width: 24rem;
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   Responsive Visibility
   ============================================ */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }

    .hide-desktop {
        display: none;
    }
}

/* ============================================
   Loading Skeleton
   ============================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        hsl(var(--muted)) 25%,
        hsl(var(--muted) / 0.5) 50%,
        hsl(var(--muted)) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: calc(var(--radius) - 2px);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 0.75rem;
}

.skeleton-card {
    height: 8rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Quick Access Cards (Statements page)
   ============================================ */
.quick-access-grid {
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: repeat(1, 1fr);
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 640px) {
    .quick-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.quick-access-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: hsl(var(--card));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    cursor: pointer;
    transition: all var(--transition-fast) ease-in-out;
}

.quick-access-card:hover {
    border-color: hsl(var(--primary) / 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   Wizard / Multi-step Form
   ============================================ */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.wizard-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1rem;
    left: calc(50% + 1.5rem);
    width: calc(100% - 3rem);
    height: 2px;
    background-color: hsl(var(--border));
}

.wizard-step.completed:not(:last-child)::after {
    background-color: hsl(var(--primary));
}

.wizard-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    position: relative;
    z-index: 1;
}

.wizard-step.active .wizard-step-number {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.wizard-step.completed .wizard-step-number {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.wizard-step-label {
    font-size: var(--text-xs);
    color: hsl(var(--muted-foreground));
    text-align: center;
}

.wizard-step.active .wizard-step-label {
    color: hsl(var(--foreground));
    font-weight: 500;
}

/* Wizard content */
.wizard-content {
    min-height: 20rem;
}

.wizard-content > div {
    display: none;
}

.wizard-content > div.active {
    display: block;
}
