/* ============================================================
   Layout — Azure Portal Shell Structure (Fluent UI)
   ============================================================ */

/* ── App Shell ─────────────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* ── Module Container ──────────────────────────────────────── */
.module-container {
    display: none;
    animation: fadeIn 0.12s ease;
}

.module-container.active {
    display: block;
}

#module-hub .container,
#module-assessment .container,
#module-spoke .container,
#module-verify-result .container,
#module-connection .container {
    max-width: 1600px !important;
}

/* 히스토리 모듈은 전체 폭 방에 최대한 확장 */
#module-designs .container {
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* ============================================================
   Sidebar — Azure Portal Left Nav (Dark)
   ============================================================ */
/* ── Sidebar — White Sidebar (Premium Corporate) ── */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-right: none;
    padding: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-mid);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 24px;
    border-bottom: none;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-secondary);
    letter-spacing: -0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 12px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary); /* Use text-secondary instead of gray-500 */
    font-size: var(--font-size-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.sidebar-menu-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.85; /* Increased from 0.7 */
    stroke-width: 1.5;
}

.sidebar-menu-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--brand-primary);
}

.sidebar-menu-item.active {
    background-color: var(--color-primary-light);
    color: var(--brand-primary);
    font-weight: 700;
}

/* Sidebar Submenu */
.sidebar-menu-item.has-submenu {
    display: block;
    height: auto;
    padding: 0;
}

.sidebar-menu-item-main {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-menu-item-main:hover {
    background-color: var(--bg-card-hover);
    color: var(--brand-primary);
}

.sidebar-submenu {
    display: none;
    padding-left: 32px;
    margin-top: 4px;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.sidebar-submenu.active {
    display: flex;
}

.sidebar-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-submenu-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--brand-primary);
}

.submenu-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    opacity: 0.5;
}

/* Sidebar Section Labels - High Visibility */
.sidebar-section-label {
    padding: 24px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

[data-theme="dark"] .sidebar-section-label {
    color: var(--gray-300); /* Brighter for dark mode */
}

/* ── Sidebar bottom strip ──────────────────────────────────── */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 0;
    flex-shrink: 0;
}

/* ============================================================
   Top Bar — Azure Portal Command Bar
   ============================================================ */
.top-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background-color: var(--bg-body);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
}

[data-theme="dark"] .top-bar {
    background-color: var(--bg-sidebar);
    border-bottom: none;
}

/* ── Seamless Flow Hero Section ──────────────────────────── */
.seamless-flow-hero {
    position: relative;
    padding: 56px 48px 36px 48px;
    margin: 0;
    background: transparent !important;
    overflow: visible;
    text-align: center;
    border: none !important;
}

/* Dashboard Background Wrap — Seamless Flow */
.dashboard-bg-wrap {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(160deg, #ffffff 0%, #f8f9fa 40%, #f3f4f6 100%);
    overflow: hidden;
    transition: background var(--transition-mid);
}

/* Flow Wave Layer 1 — 메인 레드 웨이브 */
.dashboard-bg-wrap::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -5%;
    right: -5%;
    bottom: -10%;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 560' preserveAspectRatio='none'%3E%3Cpath fill='none' stroke='%23ff0033' stroke-width='2' opacity='0.08' d='M-100,280 C100,200 200,340 400,280 C600,220 700,320 900,260 C1100,200 1200,300 1440,240'/%3E%3Cpath fill='none' stroke='%23ff0033' stroke-width='1.2' opacity='0.06' d='M-100,320 C100,240 250,380 450,310 C650,240 750,350 950,285 C1150,220 1280,330 1540,270'/%3E%3Cpath fill='none' stroke='%23ff0033' stroke-width='0.8' opacity='0.05' d='M-100,360 C150,290 300,400 500,335 C700,270 800,375 1000,310 C1200,245 1320,355 1540,295'/%3E%3Cpath fill='none' stroke='%23e9eaee' stroke-width='1.5' opacity='0.5' d='M-100,180 C150,130 300,230 500,170 C700,110 800,210 1000,155 C1200,100 1320,195 1540,140'/%3E%3Cpath fill='none' stroke='%23e9eaee' stroke-width='1' opacity='0.35' d='M-100,420 C200,360 350,450 580,390 C810,330 900,420 1100,370 C1300,320 1420,400 1540,355'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    animation: flowWave 20s ease-in-out infinite alternate;
}

/* Flow Wave Layer 2 — 하단 방사형 그라데이션 */
.dashboard-bg-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background:
        radial-gradient(ellipse 80% 60% at 20% 100%, rgba(255,0,51,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(0,176,204,0.03) 0%, transparent 70%);
}

@keyframes flowWave {
    0%   { transform: translateX(0) translateY(0) scaleX(1); }
    50%  { transform: translateX(1%) translateY(-0.5%) scaleX(1.005); }
    100% { transform: translateX(-1%) translateY(0.5%) scaleX(0.995); }
}

[data-theme="dark"] .dashboard-bg-wrap {
    background: linear-gradient(160deg, #0a0c10 0%, #0e1116 50%, #090a0f 100%);
}

[data-theme="dark"] .dashboard-bg-wrap::before {
    opacity: 0.5;
    filter: brightness(0.7);
}

[data-theme="dark"] .dashboard-bg-wrap::after {
    background:
        radial-gradient(ellipse 80% 60% at 20% 100%, rgba(255,0,51,0.03) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 100%, rgba(0,176,204,0.02) 0%, transparent 70%);
}

.hero-content-wrap {
    position: relative;
    z-index: 2;
}

.seamless-flow-hero h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.18;
}

/* Red 강조 텍스트 */
.seamless-flow-hero h1 .highlight {
    background: linear-gradient(135deg, #ff0033 0%, #cc0029 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 12px;
    letter-spacing: -0.2px;
    line-height: 1.6;
}

[data-theme="dark"] .seamless-flow-hero {
    background: transparent !important;
}

[data-theme="dark"] .hero-bg-waves {
    background: transparent !important;
}

[data-theme="dark"] .sidebar-logo-text {
    color: var(--white);
}

[data-theme="dark"] .sidebar-menu-item:not(.active) {
    color: var(--gray-200);
}

/* Page title in top bar */
.top-bar-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.top-bar-breadcrumb .separator {
    opacity: 0.4;
    font-size: 10px;
}

/* Right controls in top bar */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Main Content Area ─────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding-bottom: 40px;
    background: var(--bg-body);
    overflow-y: auto;
}

/* ============================================================
   Command Bar (Azure Portal style top actions row)
   ============================================================ */
.command-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.command-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.command-bar-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.command-bar-btn.primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.command-bar-btn.primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.command-bar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

/* ============================================================
   Cards — Fluent "surface" pattern (flat, minimal)
   ============================================================ */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.card-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* ── Section title (Azure Portal blade section header) ─────── */
.section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   Form Grid
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.form-grid.forced-single {
    grid-template-columns: 1fr !important;
}

@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   Dashboard / Home Module
   ============================================================ */
#module-home .container {
    max-width: 1200px !important;
    padding-top: 24px;
}

/* Hero in Azure Portal style: left-aligned, no huge text */
.hero-section {
    text-align: left;
    margin-bottom: 24px;
    padding: 8px 0;
}

.hero-section h1 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    margin-bottom: 0;
}

.hero-features {
    display: none;
}

/* Remove marketing copy in enterprise UI */

/* ── Dashboard Module Cards — Seamless Flow Premium ─── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.module-card {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(233,234,238,0.9);
    border-radius: 16px;
    padding: 22px 20px 18px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    text-align: left;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* 레드 왼쪽 테두리 라인 */
.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #ff0033 0%, rgba(255,0,51,0.3) 100%);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 16px 0 0 16px;
}

.module-card:hover::before {
    opacity: 1;
}

.module-card:hover {
    border-color: rgba(255,0,51,0.2);
    box-shadow: 0 4px 20px rgba(255,0,51,0.08), 0 8px 32px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

[data-theme="dark"] .module-card {
    background: rgba(20,22,28,0.85);
    border-color: rgba(255,255,255,0.07);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
}

[data-theme="dark"] .module-card:hover {
    border-color: rgba(255,0,51,0.3);
    box-shadow: 0 4px 20px rgba(255,0,51,0.12), 0 8px 32px rgba(0,0,0,0.3);
}

/* 카드 넘버링 배지 */
.module-card-num {
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 11px;
    font-weight: 800;
    color: rgba(0,0,0,0.1);
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .module-card-num {
    color: rgba(255,255,255,0.08);
}

.module-icon {
    font-size: 18px;
    margin-bottom: 12px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,0,51,0.06);
    color: #ff0033;
    transition: background 0.2s;
    flex-shrink: 0;
}

.module-card:hover .module-icon {
    background: rgba(255,0,51,0.1);
}

[data-theme="dark"] .module-icon {
    background: rgba(255,0,51,0.1);
    color: #ff4466;
}

.module-card h3 {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.module-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 14px 0;
    flex-grow: 1;
}

.module-action {
    font-size: 12px;
    font-weight: 700;
    color: #ff0033;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: -0.1px;
    transition: gap 0.2s;
}

.module-card:hover .module-action {
    gap: 7px;
}

[data-theme="dark"] .module-action {
    color: #ff4466;
}

.module-card.coming-soon {
    opacity: 0.45;
    cursor: default !important;
}

.module-card.coming-soon::before {
    display: none;
}

/* ── Feature Pills (simplified in enterprise mode) ────────── */
.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.feature-pill {
    background: var(--bg-card);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: none;
}

.feature-pill .check {
    color: var(--color-success);
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb-item {
    color: var(--color-secondary);
    cursor: pointer;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    font-size: 10px;
    opacity: 0.5;
}

.breadcrumb-item.current {
    color: var(--text-primary);
    cursor: default;
}

.breadcrumb-item.current:hover {
    text-decoration: none;
}