/* ============================================
   Layout - Open PRO / Nebula Inspired
   ============================================ */

/* Workspace Ambient Background */
.workspace-ambient-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -10;
    pointer-events: none;
    overflow: hidden;
}

/* Sleek Modern Top Horizontal Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 1.5rem;
    z-index: 1030;
    height: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.navbar .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none !important;
}

.brand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-variant);
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: var(--transition);
}

.brand-icon:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.brand-icon-lg {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.brand-icon-lg:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.brand-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: -0.02em;
    background: none;
    -webkit-text-fill-color: initial;
    background-clip: initial;
}

.version-badge {
    display: none !important;
}

.update-status {
    font-size: 0.7rem;
    color: var(--secondary);
}

/* Horizontal top nav */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    margin: 0;
}

.top-nav-pills {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.top-nav-pills .nav-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--on-surface-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.top-nav-pills .nav-link i {
    font-size: 0.95rem;
}

.top-nav-pills .nav-link:hover {
    color: var(--on-surface);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.top-nav-pills .nav-link.active {
    color: #ffffff !important;
    background: var(--primary) !important;
    border-color: transparent !important;
    font-weight: 700;
    box-shadow: 0 4px 15px var(--primary-light);
}

.top-nav-pills .nav-link.active:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

[data-theme="light"] .top-nav-pills .nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Landing Page Layout */
.landing-view {
    min-height: calc(100vh - 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    margin-top: 52px;
    position: relative;
    overflow: hidden;
}

.landing-container {
    max-width: 1100px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Workspace View */
.workspace-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    margin-top: 60px;
    position: relative;
    z-index: 1;
}

/* Layer Toolbar */
.layer-toolbar {
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .layer-toolbar {
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.company-logo-container {
    display: flex;
    align-items: center;
}

.company-logo-img {
    height: 24px;
    max-width: 90px;
    object-fit: contain;
}

.company-name-display {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--on-surface);
}

.layer-name-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--on-surface);
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.layer-name-display:hover {
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* Workspace Content */
.workspace-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* View Sections */
.view-section {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

#matrix-view {
    overflow: hidden !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#matrix-view .view-header {
    padding: 0.85rem 1.25rem 0.5rem;
    flex-shrink: 0;
}

#matrix-view #matrix-legend-bar {
    margin: 0.4rem 1.25rem 0;
    flex-shrink: 0;
}

#matrix-view #matrix-container {
    margin: 0.5rem 1.25rem 1.25rem;
    flex: 1;
    min-height: 0;
}

#matrix-view #matrix-no-results {
    padding: 3rem 1.5rem;
    flex-shrink: 0;
}

/* Reports View - Full width, no double padding */
#reports-view {
    padding: 0;
}

#reports-view .reports-container {
    padding: 1.5rem;
}

.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.view-header > div:first-child {
    flex-shrink: 0;
}

.view-header > div:last-child {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
    flex-wrap: wrap;
}

.view-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--on-surface);
    letter-spacing: -0.02em;
}

.view-subtitle {
    font-size: 0.85rem;
    color: var(--on-surface-secondary);
    margin: 0.25rem 0 0;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--primary-light), var(--shadow-md);
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--on-surface) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--on-surface-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.2rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.list-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.list-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 16px var(--primary-light), var(--shadow-md);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--on-surface);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--on-surface-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--on-surface-tertiary);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
    display: block;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* Matrix Legend Bar */
.matrix-legend-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.matrix-legend-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-right: 1.5rem;
    border-right: 1px solid var(--border);
}

.matrix-legend-section:last-child {
    border-right: none;
    padding-right: 0;
}

.matrix-legend-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--on-surface-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 0.25rem;
}

.matrix-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--on-surface-secondary);
    font-weight: 500;
}

.matrix-legend-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

/* ========================================================
   Cyber-Nebula Premium Design Polishes (Phase 2)
   ======================================================== */

:root {
    --spring-transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-transition-smooth: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Apply snappier physical spring transitions to high-frequency interactive elements */
.nav-link, 
.btn, 
.action-card, 
.tactic-checkbox-item, 
.report-preview-card, 
.entity-chip-clickable, 
.group-tab-btn, 
.group-sw-clickable,
.group-tech-item {
    transition: var(--spring-transition) !important;
}

/* Matrix Technique Cell Spring Transformations */
.technique-cell {
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    z-index: 1;
}

.technique-cell:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: inset 0 0 0 1px rgba(88, 76, 244, 0.4), 0 8px 24px rgba(88, 76, 244, 0.12) !important;
    z-index: 5;
}

/* Cyber-Nebula Dynamic Centered Radial Hover Shine */
.technique-cell::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(88, 76, 244, 0.1) 0%, transparent 65%);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: -1;
    transform: scale(0.5);
}

.technique-cell:hover::after {
    opacity: 1;
    transform: scale(1);
}

/* ========================================================
   Responsive & Immersive Navbars
   ======================================================== */

@media (max-width: 1440px) {
    /* Compress horizontal spacing on 14-inch laptops and smaller */
    .navbar .container-fluid {
        gap: 0.5rem;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .top-nav-pills {
        gap: 0.2rem;
    }
    .top-nav-pills .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    .top-nav-pills .nav-link i {
        font-size: 0.85rem;
    }
    .navbar-brand {
        gap: 0.4rem;
    }
    .brand-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 1150px) {
    /* iPad Pro / Smaller Laptops - Convert to scrollable icon-only or tight icons */
    .navbar {
        padding: 0 0.5rem;
    }
    .navbar .container-fluid {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .navbar .container-fluid::-webkit-scrollbar {
        display: none;
    }
    
    .brand-text {
        display: none !important;
    }
    
    .top-nav-pills .nav-link {
        font-size: 0 !important;
        padding: 0.4rem 0.5rem !important;
        justify-content: center;
        width: 36px;
        height: 36px;
    }
    .top-nav-pills .nav-link i {
        font-size: 1.1rem !important;
        margin-right: 0 !important;
    }
    
    /* Make the layer toolbar horizontally scrollable */
    .layer-toolbar .container-fluid {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 0.5rem;
    }
    .layer-toolbar .container-fluid::-webkit-scrollbar {
        display: none;
    }
    
    /* Hide text on toolbar buttons */
    .layer-toolbar .btn-ghost {
        font-size: 0 !important;
        padding: 0.4rem !important;
    }
    .layer-toolbar .btn-ghost i {
        font-size: 1.1rem !important;
        margin-right: 0 !important;
    }
    
    #btn-legend-editor, #btn-export-layer, #btn-save-layer {
        width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    /* Extreme squish - Mobile */
    .navbar {
        height: 54px;
        min-height: 54px;
    }
    .workspace-view {
        margin-top: 54px;
        height: calc(100vh - 54px);
    }
    .layer-name-display {
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #layer-domain-badge, #layer-version-badge {
        display: none !important;
    }
}
