/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary: #0078d4;
    --primary-dark: #005a9e;
    --secondary: #00bcf2;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;
    --danger: #dc3545;
    
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    
    --text: #212529;
    --text-muted: #6c757d;
    
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    
    --radius: 8px;
    --radius-lg: 12px;
    
    --header-height: 60px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   MENU OVERLAY
   ============================================ */
.menu-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.show {
    display: block;
    opacity: 1;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
    background: rgba(0,120,212,0.1);
}

/* ============================================
   HAMBURGER MENU - RESEARCH-BASED IMPLEMENTATION
   ============================================ */
.hamburger {
    display: none;
    width: 48px;
    height: 48px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-box {
    width: 32px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 32px;
    height: 3px;
    background-color: var(--text);
    border-radius: 4px;
    position: absolute;
    transition-property: transform;
    transition-duration: 0.15s;
    transition-timing-function: ease;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
}

.hamburger-inner::before {
    top: -10px;
}

.hamburger-inner::after {
    bottom: -10px;
}

/* Hamburger to X Animation */
.hamburger.active .hamburger-inner {
    transform: rotate(45deg);
}

.hamburger.active .hamburger-inner::before {
    top: 0;
    transform: rotate(90deg);
}

.hamburger.active .hamburger-inner::after {
    bottom: 0;
    transform: rotate(90deg);
    opacity: 0;
}

/* ============================================
   MOBILE NAVIGATION - FULL SCREEN SLIDE
   ============================================ */
.mobile-nav {
    display: flex;
    position: fixed;
    top: var(--header-height);
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: calc(100vh - var(--header-height));
    background: var(--bg-white);
    z-index: 999;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.mobile-nav.open {
    right: 0;
}

.mobile-nav-container {
    padding: 16px 0;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}

.mobile-nav-item:hover {
    background: var(--bg-light);
    color: var(--primary);
    padding-left: 28px;
}

.mobile-nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* ============================================
   HERO
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 120px 20px 60px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 16px;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 24px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: white;
}

.hero-tags {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.tag {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section {
    margin-bottom: 60px;
}

.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   EMBED CONTAINERS
   ============================================ */
.embed-container {
    position: relative;
    width: 100%;
    background: var(--bg-light);
    overflow: hidden;
}

.embed-container.large {
    height: 500px;
}

.embed-container.medium {
    height: 400px;
    min-height: 350px;
}

.embed-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.embed-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #e7f3ff;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   FEATURE GRID
   ============================================ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-light);
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-white);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}

.feature-icon {
    font-size: 1.25rem;
}

/* ============================================
   STEPS GRID
   ============================================ */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.step-card {
    background: var(--bg-white);
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    padding-top: 44px;
}

.step-badge {
    position: absolute;
    top: -16px;
    left: 24px;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,120,212,0.3);
}

.step-card h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.step-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.check-list {
    list-style: none;
}

.check-list li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.check-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* ============================================
   PERFECT DATA MODEL SCHEMA
   ============================================ */
.model-card {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.model-title {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 32px;
    color: var(--text);
}

.schema-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    min-width: 650px;
}

/* Tables */
.table {
    border-radius: var(--radius);
    background: white;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.table.fact {
    border: 3px solid var(--primary);
    width: 100%;
    max-width: 420px;
}

.table.dim {
    border: 2px solid var(--secondary);
    min-width: 220px;
    flex: 1;
}

.table.dim.wide {
    min-width: 260px;
}

.table-title {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    color: white;
}

.table-title.fact-title {
    background: var(--primary);
}

.table-title.dim-title {
    background: var(--secondary);
}

.table-content {
    padding: 16px;
}

/* Table Rows */
.row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 6px 0;
    background: var(--bg-light);
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
}

.row .key {
    width: 24px;
    text-align: center;
    font-size: 0.9rem;
}

.row .name {
    flex: 1;
    font-weight: 500;
}

.row .type {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Row Types */
.row.pk {
    background: #d4edda;
    border-left-color: var(--success);
    font-weight: 600;
}

.row.fk {
    background: #fff3cd;
    border-left-color: var(--warning);
}

.row.date-active {
    background: #e7f3ff;
    border-left-color: var(--primary);
}

.row.date-inactive {
    background: #f8f9fa;
    border-left: 3px dashed var(--text-muted);
    color: var(--text-muted);
}

.row.calc {
    background: #f3e5f5;
    border-left-color: #9c27b0;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.note {
    margin-top: 12px;
    padding: 10px;
    background: #e7f3ff;
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--primary);
    text-align: center;
    font-style: italic;
}

/* Connectors */
.connectors {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    padding: 0 40px;
}

.connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.line {
    width: 60px;
    height: 2px;
    background: var(--text-muted);
}

.arrow {
    color: var(--primary);
    font-size: 0.9rem;
    margin-top: -8px;
}

.label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dimensions Row */
.dimensions {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

/* Legend */
.legend {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.legend .badge {
    min-width: 70px;
    justify-content: center;
}

.legend .badge.active {
    background: var(--primary);
    color: white;
}

.legend .badge.inactive {
    background: var(--text-muted);
    color: white;
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-block {
    background: #1e1e1e;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 16px 0;
}

.code-header {
    background: #333;
    color: #ccc;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-copy {
    background: #555;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #666;
}

pre {
    padding: 20px;
    overflow-x: auto;
    margin: 0;
}

code {
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================
   DOWNLOAD SECTION - EMBEDDED EXCEL
   ============================================ */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.download-card {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.download-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.download-card h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.download-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.file-info {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.file-info span {
    background: var(--bg-light);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   TECH STACK
   ============================================ */
.tech-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.tech-item {
    background: var(--bg-light);
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
}

.tech-item:hover {
    background: var(--bg-white);
    box-shadow: var(--shadow);
}

.tech-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tech-item h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.tech-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   CONTACT
   ============================================ */
.contact-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    background: var(--bg-white);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.contact-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: #222;
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.site-footer p {
    opacity: 0.9;
    margin-bottom: 12px;
}

.footer-nav {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.footer-nav a {
    color: white;
    opacity: 0.8;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ============================================
   MOBILE BREAKPOINT
   ============================================ */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    
    .hamburger {
        display: block;
    }
    
    .hero {
        padding: 100px 16px 40px;
    }
    
    .main-content {
        padding: 24px 16px;
    }
    
    .embed-container.large,
    .embed-container.medium {
        height: 350px;
    }
    
    .steps-grid,
    .download-grid {
        grid-template-columns: 1fr;
    }
    
    .schema-container {
        min-width: 100%;
        padding: 10px;
    }
    
    .table.fact,
    .table.dim {
        max-width: 100%;
        min-width: auto;
        width: 100%;
    }
    
    .dimensions {
        flex-direction: column;
        align-items: center;
    }
    
    .connectors {
        padding: 0 20px;
    }
    
    .connector {
        transform: scale(0.8);
    }
    
    .model-card {
        padding: 20px;
    }
    
    .legend {
        padding: 16px;
    }
    
    .legend-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
    }
    
    .contact-link {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (min-width: 769px) {
    .mobile-nav,
    .menu-overlay {
        display: none !important;
    }
}