/* ========================================
   ALBION CRAFT CALCULATOR v3.0
   layout.css — Sidebar, Grid, Responsive
   ======================================== */

/* === APP LAYOUT === */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header header"
        "sidebar content";
    min-height: 100vh;
}

/* === HEADER === */
.app-header {
    grid-area: header;
    background: linear-gradient(135deg, #111827 0%, #1a2235 50%, #111827 100%);
    border-bottom: 2px solid var(--gold-dark);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    box-shadow: 0 4px 30px rgba(0,0,0,.5);
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-gold);
    opacity: 0.6;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-gold);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-gold);
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    line-height: 1.3;
}

.logo-text span {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 14px;
    font-size: 12px;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.api-timestamp {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* === SIDEBAR === */
.app-sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, rgba(15, 20, 36, 0.97) 0%, rgba(11, 15, 25, 0.99) 100%);
    border-right: 1px solid rgba(30, 41, 59, 0.6);
    padding: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Subtle radial glow at the top */
.app-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    background: radial-gradient(ellipse at 30% 0%, rgba(212, 168, 67, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Inner shadow for depth */
.app-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, rgba(212, 168, 67, 0.15) 0%, transparent 30%, transparent 70%, rgba(212, 168, 67, 0.08) 100%);
    pointer-events: none;
    z-index: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 10px 8px;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* === SIDEBAR GROUPS === */
.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.sidebar-group:last-child {
    margin-bottom: 0;
}

.sidebar-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 14px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    user-select: none;
    opacity: 0.7;
    margin-bottom: 2px;
}

.group-title-icon {
    width: 12px;
    height: 12px;
    stroke-width: 2;
    opacity: 0.5;
    color: var(--text-muted);
}

/* === NAV ITEMS === */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    text-decoration: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
    overflow: hidden;
}

/* Hover gradient sweep */
.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(212, 168, 67, 0.04) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: inherit;
    pointer-events: none;
}

.nav-item:hover::before {
    opacity: 1;
}

.nav-item:hover {
    background: rgba(26, 34, 53, 0.8);
    color: var(--text-primary);
    border-color: rgba(30, 41, 59, 0.8);
    transform: translateX(3px);
}

/* Active state with left gold indicator */
.nav-item.active {
    background: rgba(212, 168, 67, 0.08);
    color: var(--gold-light);
    border-color: rgba(212, 168, 67, 0.15);
    font-weight: 600;
    box-shadow: 0 0 20px rgba(212, 168, 67, 0.06);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--gradient-gold);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(212, 168, 67, 0.4);
    animation: activeIndicatorIn 0.3s ease-out;
}

@keyframes activeIndicatorIn {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* === NAV ICON WRAPPER === */
.nav-icon-wrap {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(30, 41, 59, 0.6);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.nav-svg-icon {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.nav-item:hover .nav-icon-wrap {
    background: rgba(212, 168, 67, 0.08);
    border-color: rgba(212, 168, 67, 0.12);
}

.nav-item:hover .nav-svg-icon {
    color: var(--gold-primary);
}

.nav-item.active .nav-icon-wrap {
    background: rgba(212, 168, 67, 0.12);
    border-color: rgba(212, 168, 67, 0.2);
    box-shadow: 0 0 12px rgba(212, 168, 67, 0.1);
}

.nav-item.active .nav-svg-icon {
    color: var(--gold-light);
    filter: drop-shadow(0 0 4px rgba(212, 168, 67, 0.3));
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}

/* === EXTERNAL NAV LINK (Bridge) === */
.nav-item-external {
    color: #94a3b8;
    font-size: 13px;
}

.nav-item-external:hover {
    background: rgba(99, 102, 241, 0.06) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.12) !important;
}

.nav-item-external:hover .nav-icon-wrap {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.15);
}

.nav-item-external:hover .nav-svg-icon {
    color: #a5b4fc;
}

.nav-ext-badge {
    margin-left: auto;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-item-external:hover .nav-ext-badge {
    opacity: 1;
    color: #a5b4fc;
}

/* === SIDEBAR FOOTER === */
.sidebar-footer {
    padding: 12px 10px;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.sidebar-footer-card {
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid rgba(30, 41, 59, 0.6);
    border-radius: var(--border-radius-sm);
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
}

/* Top gradient accent on footer card */
.sidebar-footer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-dark));
    opacity: 0.5;
}

.footer-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.footer-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green-primary);
    box-shadow: 0 0 6px var(--green-glow);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green-glow); }
    50% { opacity: 0.6; box-shadow: 0 0 10px var(--green-glow); }
}

.footer-status-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--green-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-version {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.footer-version-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.5px;
}

.footer-version-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold-primary);
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.footer-api-label {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* === CONTENT AREA === */
.app-content {
    grid-area: content;
    padding: 24px;
    max-width: 1400px;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
}

/* === PAGE CONTAINERS === */
.page {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.page.active {
    display: flex;
}

/* Placeholder sayfa stili */
.page-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: var(--text-muted);
}

.page-placeholder .placeholder-icon {
    font-size: 64px;
    opacity: 0.3;
}

.page-placeholder h2 {
    font-size: 24px;
    color: var(--text-secondary);
}

.page-placeholder p {
    font-size: 14px;
    max-width: 400px;
    text-align: center;
    line-height: 1.6;
}

/* === FOOTER === */
.app-footer {
    text-align: center;
    padding: 20px 24px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    line-height: 1.6;
}

/* === MOBILE BOTTOM NAV === */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding: 0;
    height: 60px;
}

.mobile-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-fast);
    text-decoration: none;
    border: none;
    background: none;
}

.mobile-nav-item.active {
    color: var(--gold-primary);
}

.mobile-nav-item .mobile-nav-icon {
    font-size: 20px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }
    
    .app-content {
        padding: 20px 16px;
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "content";
    }

    .app-sidebar {
        display: none;
    }

    .mobile-nav {
        display: block;
    }

    .app-content {
        padding: 16px 12px;
        padding-bottom: 80px; /* Mobile nav height + gap */
        height: calc(100vh - var(--header-height) - 60px);
    }

    .app-header {
        padding: 0 16px;
    }

    .logo-text h1 {
        font-size: 15px;
    }

    .logo-text span {
        display: none;
    }

    .header-badge {
        display: none;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0 12px;
    }

    .app-content {
        padding: 12px 8px;
        padding-bottom: 80px;
    }

    .header-actions {
        gap: 8px;
    }
}
