/* app/static/css/base.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-gradient: radial-gradient(circle at top right, #093425 0%, #03140e 50%, #010604 100%);
    --bg: #020705;
    --surface: rgba(6, 22, 16, 0.55);
    --surface-solid: #04120e;
    --surface-hover: rgba(12, 38, 29, 0.7);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(16, 185, 129, 0.3);
    --text: #f0fdf4;
    --muted: #839d91;
    
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-glow: rgba(16, 185, 129, 0.25);
    --primary-light: #6ee7b7;
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    --warning-text: #fef08a;
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --success-text: #a7f3d0;
    
    --danger: #f43f5e;
    --danger-glow: rgba(244, 63, 94, 0.2);
    --danger-text: #fecdd3;
    
    --radius: 18px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.75);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
}

/* App Shell Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: rgba(4, 15, 11, 0.6);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.brand-logo svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 0.25s ease;
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.nav-link:hover svg {
    transform: translateX(3px);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-left: 3px solid var(--primary);
    box-shadow: inset 5px 0 10px rgba(16, 185, 129, 0.05);
}

.nav-link.active svg {
    stroke: var(--primary);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0d3b2e;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid var(--border);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: var(--muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--danger-text);
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-logout:hover {
    background: var(--danger-glow);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    min-width: 0;
    padding: 40px;
    min-height: 100vh;
}

/* Alerts and Flashes */
.flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 300px;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background-color: rgba(6, 30, 20, 0.85);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--success-text);
}

.alert-danger {
    background-color: rgba(45, 12, 18, 0.85);
    border-color: rgba(244, 63, 94, 0.4);
    color: var(--danger-text);
}

.alert-warning {
    background-color: rgba(36, 23, 5, 0.85);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--warning-text);
}

.alert-info {
    background-color: rgba(10, 24, 40, 0.85);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.alert-close {
    cursor: pointer;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* Responsive Layout for Mobile Devices */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        padding: 15px 15px 80px 15px !important;
    }

    /* Mobile Bottom Navigation */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(4, 15, 11, 0.9);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        padding: 0 10px;
    }

    .mobile-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--muted);
        font-size: 0.7rem;
        font-weight: 600;
        text-decoration: none;
        flex: 1;
        text-align: center;
        transition: all 0.2s;
    }

    .mobile-nav-link svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 2;
        fill: none;
    }

    .mobile-nav-link.active {
        color: var(--primary-light);
    }
    
    /* Calculator Grid and panels stacking on mobile */
    .calculator-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .history-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* Hide mobile bottom nav on desktop */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}
