/**
 * Layout System - Phase 1.5
 * 75-25 responsive grid layout with content blocks
 * Enhanced with layered card design system
 */

/* Page Layout Container */
.ds-page-layout {
    display: grid;
    grid-template-columns: 1fr 280px; /* 80-20 approximation - sidebar reduced */
    gap: var(--spacing-6);
    padding: var(--spacing-6);
    max-width: 1400px;
    margin: 0 auto;
}

/* Main Content Area (75%) */
.ds-main-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-6);
    min-width: 0; /* Prevent overflow */
}

/* Sidebar Area (25%) */
.ds-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    position: sticky;
    top: calc(64px + var(--spacing-6)); /* Offset for navbar + padding */
    height: fit-content;
    max-height: calc(100vh - 64px - var(--spacing-12));
    overflow-y: auto;
}

/* Content Block Component - Layered Card Design (Layer 3) */
.ds-content-block {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-xl);
    padding: var(--spacing-6);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.3),
        0 4px 6px -2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
}

.ds-content-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.05) 0%, transparent 50%);
    border-radius: var(--radius-xl);
    pointer-events: none;
}

.ds-content-block:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.4),
        0 10px 10px -5px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.25);
}

/* Content Block Header */
.ds-content-block-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-5);
    padding-bottom: var(--spacing-4);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.ds-content-block-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ds-content-block-title-wrapper {
    flex: 1;
}

.ds-content-block-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 700;
    color: #f8fafc;
}

.ds-content-block-subtitle {
    margin: var(--spacing-1) 0 0 0;
    font-size: var(--text-sm);
    color: #cbd5e1;
}

/* Content Block Body */
.ds-content-block-body {
    color: #f8fafc;
}

/* Skip Link for Accessibility */
.ds-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent-primary);
    color: white;
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    z-index: var(--z-tooltip);
}

.ds-skip-link:focus {
    top: var(--spacing-2);
}

/* Responsive Breakpoints */

/* Tablet: 768px - 1024px (65-35 split) */
@media (max-width: 1024px) and (min-width: 768px) {
    .ds-page-layout {
        grid-template-columns: 1fr 280px; /* 65-35 approximation */
        gap: var(--spacing-4);
        padding: var(--spacing-4);
    }
    
    .ds-sidebar {
        top: calc(64px + var(--spacing-4));
        max-height: calc(100vh - 64px - var(--spacing-8));
    }
}

/* Mobile: < 768px (100% stacked) */
@media (max-width: 767px) {
    .ds-page-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-4);
        padding: var(--spacing-4);
    }
    
    .ds-sidebar {
        position: static;
        max-height: none;
    }
    
    .ds-content-block {
        padding: var(--spacing-4);
    }
    
    .ds-content-block-header {
        flex-direction: column;
        gap: var(--spacing-2);
    }
}

/* Loading State */
.ds-content-block.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ds-content-block.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--border-default);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
