/**
 * Layout Styles
 * Top navigation bar, main content, and structural components
 * Extracted from inline styles in layout.html for better maintainability
 */

/* ===========================================
   TOP NAVIGATION BAR
   =========================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    border-bottom: none;
    box-shadow: none;
}

.topbar-logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: #f8fafc;
    text-shadow: none;
}

.topbar-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.topbar-link {
    color: #e0e0e0;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.topbar-link.has-dropdown::after {
    content: '\25BE';
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-link:hover {
    color: var(--accent-hover);
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* ===========================================
   TOPBAR ACTION BUTTONS
   =========================================== */

.topbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

.topbar-action-btn img {
    display: block;
    width: 24px;
    height: 24px;
}

/* Fixed position for login page (no topbar) */
.topbar-actions-fixed {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    margin-left: 0;
}

.topbar-action-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    border-radius: 4px;
}

.topbar-action-btn:hover {
    color: var(--accent-hover);
    background: rgba(59, 130, 246, 0.12);
}

/* ===========================================
   DROPDOWN MENUS - HIGH FANTASY STYLE
   =========================================== */

.topbar-dropdown {
    position: relative;
    overflow: visible;
}

.topbar-dropdown-content {
    display: none;
    position: absolute;
    background: #080808 !important;
    background-color: #080808 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
    z-index: 1001;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-top: 2px solid rgba(59, 130, 246, 0.55);
    border-radius: 0;
    top: 100%;
    left: 0;
    right: auto;
    padding: 0.5rem 0;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 600px;
    width: max-content;
    overflow: visible !important;
}

.topbar-dropdown:hover .topbar-dropdown-content,
.topbar-dropdown.is-open .topbar-dropdown-content {
    display: flex;
    overflow: visible !important;
}

.topbar-dropdown-item {
    color: #a9a9a9;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    width: 220px;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-bottom: 1px solid #1a1a1a;
    box-sizing: border-box;
    background-color: #080808 !important;
    opacity: 1 !important;
    position: relative;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.topbar-dropdown-item:last-child {
    border-bottom: none;
}

.topbar-dropdown-item:hover {
    background-color: #121212;
    color: var(--accent-hover);
    text-shadow: 0 0 6px rgba(59, 130, 246, 0.35);
    padding-left: 20px;
}

/* ===========================================
   NESTED DROPDOWNS
   =========================================== */

.nested-dropdown {
    position: relative;
    display: block;
}

.topbar-dropdown-item.has-submenu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.nested-dropdown-content {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: #080808 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-width: 180px;
    width: max-content;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
    z-index: 1003;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-left: 2px solid rgba(59, 130, 246, 0.55);
    border-radius: 0;
    padding: 0.5rem 0;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 80vh;
    overflow: visible !important;
}

.nested-dropdown:hover>.nested-dropdown-content,
.nested-dropdown.is-open>.nested-dropdown-content {
    display: flex;
}

.nested-dropdown-content .topbar-dropdown-item {
    width: auto;
    min-width: 180px;
    white-space: normal;
    box-sizing: border-box;
}

.nested-dropdown-content .topbar-dropdown-item:hover {
    padding-left: 20px;
}

.nested-dropdown-content .nested-dropdown {
    width: auto;
    min-width: 180px;
}

/* ===========================================
   MAIN CONTENT AREA
   =========================================== */

.main-content {
    margin-top: 80px;
    padding: 0;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin-right: 0 !important;
    overflow-y: auto;
    height: calc(100vh - 80px);
    display: block;
    background-color: transparent;
}

.markdown-body {
    width: 100%;
    max-width: 1000px;
    padding: 2rem 4rem;
    margin: 0 auto;
    min-height: 100%;
    box-sizing: border-box;
    line-height: 1.8;
    font-size: 1.125rem;
}

/* ===========================================
   APP CONTAINER (auth is enforced by middleware)
   =========================================== */

.app-container {
    display: flex;
    flex-direction: column;
}

/* ===========================================
   FIREFLY CANVAS
   =========================================== */

#firefly-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.app-container {
    position: relative;
    z-index: 2;
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--accent-color);
    color: var(--bg-color);
    padding: 8px 16px;
    z-index: 10000;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    font-weight: 600;
    transform: translateY(-120%);
    transition: transform 0.3s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================
   PASSWORD INPUT FOCUS STATES
   =========================================== */

#password-input:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.22);
}

#password-submit:hover {
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}