/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #06070a;
    color: #d1d4dc;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background-color: #131722;
    border-bottom: 1px solid #2a2e39;
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: -0.01em;
}

.search-bridge {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-bridge input {
    background-color: #06070a;
    border: 1px solid #2a2e39;
    color: #e2e8f0;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 300px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-bridge input:focus {
    border-color: #2962ff;
}

.search-bridge button {
    background-color: #2962ff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.search-bridge button:hover {
    background-color: #1e4bd8;
}

/* Ticker Tape */
.ticker-wrapper {
    height: 44px;
    border-bottom: 1px solid #2a2e39;
    background-color: #131722;
}

/* App Container */
.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    padding: 16px;
    max-width: 100%;
    margin: 0 auto;
}

/* Widget Box (Glass/Panel) */
.widget-box {
    background-color: #131722;
    border-radius: 8px;
    border: 1px solid #2a2e39;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Quick Links Demo */
.quick-links {
    gap: 12px;
    padding: 16px;
}

.quick-links h3 {
    font-size: 0.95rem;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.quick-links p {
    font-size: 0.8rem;
    color: #787b86;
    margin-bottom: 10px;
}

.hot-stocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-stock-btn {
    background: #06070a;
    border: 1px solid #2a2e39;
    color: #d1d4dc;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.hot-stock-btn:hover {
    background: #2a2e39;
    color: white;
    border-color: #2962ff;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Advanced Chart */
.main-chart {
    height: 600px;
    padding: 0;
}

/* Dynamic Widgets Grid */
.dynamic-widgets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Bottom Widgets */
.bottom-widgets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: #787b86;
    font-size: 0.85rem;
    border-top: 1px solid #2a2e39;
    margin-top: 40px;
}

footer a {
    color: #2962ff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* TradingView Widget Container Overrides */
.tradingview-widget-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tradingview-widget-container__widget {
    flex: 1;
    min-height: 0;
}

/* Widget content should fill container */
.widget-box > .tradingview-widget-container,
.widget-box > div[id$="-container"] {
    height: 100%;
}

/* Loading and Error States */
.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #787b86;
    font-size: 0.9rem;
    background-color: #131722;
}

.widget-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ef4444;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
    background-color: #131722;
}

/* Disabled button state */
.search-bridge button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: 1px solid #2a2e39;
    color: #e2e8f0;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mobile-menu-btn:hover {
    background: #2a2e39;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .app-container {
        padding: 12px;
        gap: 12px;
    }
    .sidebar {
        width: 280px;
    }
    .app-container {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 1200px) {
    .dynamic-widgets-grid {
        grid-template-columns: 1fr;
    }
    .main-chart {
        height: 450px;
    }
    #symbol-info-container { height: 200px; }
    #technical-analysis-container { height: 350px; }
    #fundamental-data-container { height: 350px; }
    #company-profile-container { height: 350px; }
}

@media (max-width: 992px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .search-bridge {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: #131722;
        padding: 12px 16px;
        border-bottom: 1px solid #2a2e39;
        z-index: 99;
        display: none;
        gap: 8px;
    }
    .search-bridge.active {
        display: flex;
    }
    .search-bridge input {
        flex: 1;
        width: auto;
    }
    .search-bridge button span {
        display: inline;
    }
    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        order: -1;
    }
    .sidebar .widget-box {
        height: 300px !important;
    }
    .quick-links {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0 16px;
        height: 56px;
    }
    .logo h1 {
        font-size: 1.1rem;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .search-bridge {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: #131722;
        padding: 12px 16px;
        border-bottom: 1px solid #2a2e39;
        z-index: 99;
        display: none;
        gap: 8px;
    }
    .search-bridge.active {
        display: flex;
    }
    .search-bridge input {
        flex: 1;
        width: auto;
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    .search-bridge button span {
        display: none;
    }
    .search-bridge button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    .app-container {
        padding: 10px;
        gap: 10px;
    }
    .sidebar {
        grid-template-columns: 1fr;
    }
    .main-chart {
        height: 350px;
    }
    .widget-box {
        border-radius: 6px;
    }
    .quick-links h3 {
        font-size: 0.9rem;
    }
    .quick-links p {
        font-size: 0.75rem;
    }
    footer {
        padding: 30px 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .ticker-wrapper {
        height: 38px;
    }
    .app-header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px;
        gap: 10px;
    }
    .logo {
        width: 100%;
        justify-content: center;
    }
    .search-bridge {
        width: 100%;
    }
    .search-bridge input {
        flex: 1;
        width: auto;
    }
    .search-bridge.active {
        top: auto;
        position: relative;
    }
    .app-container {
        padding: 8px;
        gap: 8px;
    }
    .main-chart {
        height: 280px;
    }
    #symbol-info-container { height: 150px; }
    #technical-analysis-container { height: 280px; }
    #fundamental-data-container { height: 280px; }
    #company-profile-container { height: 280px; }
    .widget-box[style*="height: 500px"] { height: 350px !important; }
    .widget-box[style*="height: 600px"] { height: 450px !important; }
    .widget-box[style*="height: 300px"] { height: 250px !important; }
    footer {
        padding: 20px 12px;
        margin-top: 20px;
    }
}
