/* CSS Variables for Indian Markets Workstation (Harmony Light Theme) */

:root {
    --card-bg: rgba(13, 23, 48, 0.65);
    --card-bg-solid: #0d1730;
    --bg-main: #060d1f;
    --border-color: rgba(26, 41, 81, 0.7);
    --text-color: #f0f4fc;
    --accent-blue: #2962FF;
    --accent-blue-gradient: linear-gradient(135deg, hsl(224, 100%, 57%), hsl(263, 90%, 50%));
    
    --bg-header: rgba(13, 23, 48, 0.85);
    --bg-card: rgba(13, 23, 48, 0.65);
    --text-primary: #f0f4fc;
    --text-secondary: #a0aec0;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-blue-hover: #1e40af;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 16px 48px 0 rgba(41, 98, 255, 0.22);
    --glass-blur: blur(12px) saturate(180%);
    --border-glow: 1px solid rgba(255, 255, 255, 0.07);
    --border-glow-hover: 1px solid rgba(41, 98, 255, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden; /* Lock scroll, full height canvas */
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(at 0% 0%, hsla(242, 85%, 15%, 0.4) 0px, transparent 50%),
        radial-gradient(at 90% 10%, hsla(224, 90%, 12%, 0.3) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Header styling */
.app-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.header-container {
    width: 100%;
    max-width: 1600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    margin-left: 40px;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.main-nav a:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg);
}

.main-nav a.active {
    color: var(--text-primary);
    background-color: rgba(41, 98, 255, 0.15);
    border: 1px solid rgba(41, 98, 255, 0.3);
}

/* Search Area */
.search-container {
    position: relative;
    width: 320px;
}

.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-bar input {
    background-color: #0a1226;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--accent-blue);
    background-color: #0d1730;
}

/* Suggestion Box */
.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 6px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 101;
    display: none;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: rgba(41, 98, 255, 0.05);
}

.suggestion-symbol {
    font-weight: 700;
    color: var(--text-primary);
}

.suggestion-name {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.suggestion-exch {
    background: rgba(17, 24, 39, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Full-Page Workstation Container */
.app-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Fullscreen Chart Container */
.chart-frame-inner {
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
    background-color: #0d1730;
}

/* Loading overlay */
.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.95rem;
    background-color: #0d1730;
    gap: 12px;
}

.widget-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--accent-red);
    font-size: 0.95rem;
    text-align: center;
    padding: 20px;
    background-color: #0d1730;
    gap: 8px;
}

/* Chart Details Header Bar (Float inside chart container) */
.chart-details-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: #fafbfe;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
}

.chart-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-info-left h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.chart-badge-exch {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

.chart-info-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chart-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.chart-change {
    font-size: 0.9rem;
    font-weight: 700;
}

.price-up { color: var(--accent-green); }
.price-down { color: var(--accent-red); }

/* Mobile responsive menu */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

/* Webview Launch Button styling */
.webview-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--accent-blue);
    color: #0d1730;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 4px 12px rgba(41, 98, 255, 0.15);
}

.webview-btn:hover {
    background-color: var(--accent-blue-hover);
    box-shadow: 0 6px 16px rgba(41, 98, 255, 0.25);
    transform: translateY(-1px);
}

.webview-btn:active {
    transform: translateY(1px);
}

.webview-btn svg {
    flex-shrink: 0;
}

/* Clock styling */
.time-display {
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    background: #0a1226;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Spinner */
.spinner {
    border: 3px solid rgba(17, 24, 39, 0.1);
    width: 24px; height: 24px;
    border-radius: 50%;
    border-left-color: var(--accent-blue);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0d1730;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-blue);
    padding: 12px 24px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    z-index: 1000;
    display: flex;
    align-items: center;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Search Modal */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.search-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: #0d1730;
    border: 1px solid #1a2951;
    border-radius: 16px;
    width: 90%;
    max-width: 550px;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-30px);
    transition: transform 0.25s ease;
}

.search-modal.active .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.modal-close-btn:hover {
    color: var(--accent-red);
    background: rgba(255, 61, 0, 0.1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-search-container {
    position: relative;
    width: 100%;
}

#modal-symbol-search {
    width: 100%;
    background-color: #0a1226;
    border: 1px solid #1a2951;
    color: #f0f4fc;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

#modal-symbol-search:focus {
    background-color: #0d1730;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}

.modal-suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 1001;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .app-header {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
        justify-content: space-between;
    }
    
    .logo {
        flex: 1;
        order: 1;
    }
    
    .time-display {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex;
        order: 3;
    }
    
    .search-container {
        width: 100%;
        order: 4;
    }
    
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 8px 16px rgba(0,0,0,0.12);
        z-index: 999;
        display: none;
        flex-direction: column;
        gap: 4px;
        margin: 0 !important;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .main-nav a {
        padding: 12px 16px;
        border-radius: 8px;
        transition: background-color 0.2s;
        width: 100%;
        text-align: left;
    }
    
    .main-nav a:hover {
        background-color: var(--bg-main);
    }
    
    .main-nav a.active::after {
        display: none;
    }
    
    .main-nav a.active {
        background-color: rgba(41, 98, 255, 0.08);
        color: var(--accent-blue);
    }
    
    .chart-details-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 16px;
    }
    
    .chart-info-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .webview-btn {
        display: none !important;
    }
}


