/* ========================================
   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;
}

/* === TOP WINNERS LEADERBOARD === */
.sidebar-top-winners {
    padding: 0 10px;
    position: relative;
    z-index: 1;
}

.top-winners-card {
    background: rgba(212, 168, 67, 0.04);
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.top-winners-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(212, 168, 67, 0.08);
}

.top-winners-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--gold-primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.top-winners-subtitle {
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.top-winners-list {
    padding: 6px 8px;
}

.top-winner-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.top-winner-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.top-winner-rank {
    font-size: 14px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.top-winner-name {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-winner-profit {
    font-size: 10px;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    white-space: nowrap;
}

.top-winner-profit.positive {
    color: #4ade80;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.2);
}

.top-winner-profit.negative {
    color: #f87171;
}

/* === 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;
    }
}

/* === FLOATING SOCIAL BUBBLES === */
.floating-social-bubbles {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 8px;
    z-index: 9999;
}

.social-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(212, 168, 67, 0.25);
    color: var(--text-muted);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    text-decoration: none;
}

.social-bubble i,
.social-bubble svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.social-bubble:hover {
    color: var(--text-primary);
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.social-bubble.youtube:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #ff4d4d;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.social-bubble.instagram:hover {
    background: rgba(236, 72, 153, 0.25);
    border-color: rgba(236, 72, 153, 0.6);
    color: #ff5eb4;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
}

.social-bubble.discord:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.6);
    color: #7d80ff;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.social-bubble:hover i,
.social-bubble:hover svg {
    transform: scale(1.1);
}

/* === BRAND LOGO === */
.brand-logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.4));
    transition: transform 0.3s ease;
}

.brand-logo-img:hover {
    transform: scale(1.08) rotate(3deg);
}

/* === APP FOOTER === */
.app-footer {
    margin-top: 60px;
    padding: 40px 24px 30px;
    background: rgba(17, 24, 39, 0.45);
    border-top: 1px solid rgba(212, 168, 67, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    gap: 40px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 40px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.3));
}

.footer-brand-name {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.footer-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 320px;
}

.footer-links-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-links-group h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-nav-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.25s ease;
    display: inline-block;
}

.footer-nav-link:hover {
    color: var(--gold-primary);
    transform: translateX(4px);
}

.footer-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    opacity: 0.75;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-dev-credit {
    font-weight: 500;
    color: var(--gold-light);
    opacity: 0.8;
}

/* Responsiveness */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .app-footer {
        margin-top: 40px;
        padding: 30px 16px 20px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
