/* 
 * Stock Forecast - Design System 
 */

:root {
    --bg-dark: #0a0e27;
    --bg-card: rgba(26, 31, 58, 0.7);
    --accent-blue: #00d4ff;
    --accent-green: #00ff88;
    --accent-red: #ff4d4d;
    --accent-amber: #ffaa00;
    --text-primary: #ffffff;
    --text-secondary: #b0b3c1;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Base Styles */
h1,
h2,
h3,
h4 {
    color: #fff;
    margin-bottom: 1rem;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: 0.3s;
}

a:hover {
    filter: brightness(1.2);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Mobile Top Bar & Overlay Toggle */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive Queries */
/* Sidebar */
aside {
    width: 280px;
    background: rgba(10, 14, 39, 0.95);
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    min-height: 100vh;
}

.sidebar-header {
    margin-bottom: 3rem;
}

.sidebar-logo {
    color: var(--accent-blue);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: 0.3s;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--glass-bg);
    color: #fff;
}

.nav-link.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.logout-section {
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.logout-link {
    color: var(--accent-red);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    transition: 0.3s;
}

.logout-link:hover {
    opacity: 0.8;
}

/* Mobile Top Bar & Overlay Toggle */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive Queries */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
    }

    aside {
        width: 100% !important;
        min-height: auto !important;
        height: 70px !important;
        padding: 0 1.5rem !important;
        position: sticky;
        top: 0;
        z-index: 1000;
        flex-direction: column !important;
        /* Reset to column for the absolute menu */
        justify-content: center !important;
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-bottom: 0;
    }

    .aside-menu {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: #0a0e27;
        padding: 2rem;
        z-index: 999;
        overflow-y: auto;
        border-top: 1px solid var(--glass-border);
    }

    aside.active .aside-menu {
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .main-content {
        padding: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .portfolio-grid {
        grid-template-columns: 1fr !important;
    }

    .reco-container {
        grid-template-columns: 1fr !important;
    }

    .glass-card {
        padding: 1.5rem !important;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #00a3ff);
    color: #000;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

/* Glassmorphism Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Auth Pages Wrapper */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1a237e, #0a0e27);
}

.auth-card {
    width: 100%;
    max-width: 450px;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.1);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

select option {
    background: #0f172a;
    color: #fff;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Notifications */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(255, 77, 77, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.alert-success {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

/* Professional Badges & Tags */
.type-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
}

.badge-buy {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge-sell {
    background: rgba(255, 77, 77, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.badge-hold {
    background: rgba(255, 170, 0, 0.1);
    color: var(--accent-amber);
    border: 1px solid rgba(255, 170, 0, 0.2);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

.alert-error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.alert small {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    opacity: 0.8;
    word-break: break-all;
}


/* Ticker Animation */
@keyframes tickerScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Premium AI Loading Overlay */
.ai-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.95);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.ai-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-core {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 2rem;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 3s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: var(--accent-cyan);
    animation: spin 2s linear reverse infinite;
}

.loader-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: #a855f7;
    animation: spin 1.5s linear infinite;
}

.loader-scan {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--accent-blue), transparent);
    animation: scan 2s ease-in-out infinite;
    box-shadow: 0 0 20px var(--accent-blue);
}

.loader-text {
    text-align: center;
}

.loader-status {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.loader-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes scan {

    0%,
    100% {
        transform: translateX(-100px);
        opacity: 0;
    }

    50% {
        transform: translateX(100px);
        opacity: 1;
    }
}