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

:root {
    /* Colors - iOS Light Theme inspired */
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9f9f9;
    --bg-elevated: #fafafa;
    
    --accent-blue: #007aff;
    --accent-green: #34c759;
    --accent-teal: #5ac8fa;
    --accent-purple: #af52de;
    --accent-red: #ff3b30;
    --accent-orange: #ff9500;
    
    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-tertiary: #6e6e73;
    
    --border-color: #d2d2d7;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-tertiary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.nav-tab {
    flex: 1;
    padding: 14px 24px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.nav-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.nav-tab.active {
    background: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

/* ===== Sections ===== */
.section {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-tertiary);
    font-size: 1rem;
}

/* ===== Search Box ===== */
.search-box {
    margin-top: 20px;
}

#searchInput {
    width: 100%;
    max-width: 500px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

/* ===== Dictionary Grid ===== */
.dictionary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.term-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-blue), var(--accent-teal));
    opacity: 0;
    transition: var(--transition);
}

.term-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-blue);
    background: var(--bg-secondary);
}

.term-card:hover::before {
    opacity: 1;
}

.term-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.term-icon {
    font-size: 1.5rem;
}

.term-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.term-full {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    font-style: italic;
}

.term-definition {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.term-example {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-green);
}

.term-example strong {
    color: var(--accent-green);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.term-example p {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ===== Simulator ===== */
.simulator-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
}

.input-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.label-icon {
    font-size: 1.2rem;
}

.select-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.select-input:hover {
    border-color: var(--accent-blue);
}

.select-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.simulate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-teal) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.simulate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
}

.simulate-btn:active {
    transform: translateY(0);
}

.simulate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== Results Panel ===== */
.results-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    min-height: 500px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.results-content {
    animation: fadeIn 0.4s ease-in-out;
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.result-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.result-subtitle {
    color: var(--text-tertiary);
    font-size: 1rem;
}

.result-section {
    margin-bottom: 28px;
}

.result-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 14px;
}

.result-section-icon {
    font-size: 1.4rem;
}

.result-content-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    border-left: 4px solid var(--accent-blue);
}

.result-item {
    margin-bottom: 12px;
    line-height: 1.7;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-label {
    color: var(--accent-teal);
    font-weight: 600;
    margin-right: 8px;
}

.result-value {
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 4px 4px 4px 0;
}

.badge-success {
    background: rgba(48, 209, 88, 0.2);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.badge-warning {
    background: rgba(255, 159, 10, 0.2);
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
}

.badge-danger {
    background: rgba(255, 69, 58, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.badge-info {
    background: rgba(90, 200, 250, 0.2);
    color: var(--accent-teal);
    border: 1px solid var(--accent-teal);
}

.risk-level {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-top: 10px;
}

.risk-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.risk-low {
    background: var(--accent-green);
}

.risk-medium {
    background: var(--accent-orange);
}

.risk-high {
    background: var(--accent-red);
}

/* ===== Tooltip ===== */
.tooltip {
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-md);
    padding: 16px;
    max-width: 350px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tooltip.show {
    opacity: 1;
}

.tooltip-title {
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 8px;
    font-size: 1rem;
}

.tooltip-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Footer ===== */
.footer {
    margin-top: 60px;
    padding: 30px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .simulator-container {
        grid-template-columns: 1fr;
    }
    
    .dictionary-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .nav-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    .dictionary-grid {
        grid-template-columns: 1fr;
    }
    
    .input-panel,
    .results-panel {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 15px;
    }
    
    .logo {
        font-size: 1.7rem;
    }
    
    .term-card {
        padding: 18px;
    }
    
    .result-title {
        font-size: 1.5rem;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ===== Ticker Search Section ===== */
.ticker-search-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.ticker-search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.ticker-search-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ticker-search-box {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.ticker-input {
    flex: 1;
    max-width: 300px;
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    transition: var(--transition);
}

.ticker-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
    background: var(--bg-secondary);
}

.ticker-search-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-teal) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

.ticker-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.35);
}

.ticker-search-btn:active {
    transform: translateY(0);
}

.ticker-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ticker-info-panel {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(90, 200, 250, 0.05) 100%);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: var(--radius-md);
}

.ticker-info-panel.show {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

.ticker-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.ticker-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ticker-info-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticker-info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.ticker-info-value.positive {
    color: var(--accent-green);
}

.ticker-info-value.negative {
    color: var(--accent-red);
}

.ticker-company-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Timing Selector (Before/After Earnings) ===== */
.timing-selector {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-blue);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.timing-selector-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.timing-icon {
    font-size: 1.5rem;
}

.timing-selector-header strong {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.timing-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.timing-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    min-height: 120px;
}

.timing-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(0, 122, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.timing-btn.active {
    border-color: var(--accent-blue);
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(90, 200, 250, 0.1) 100%);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.timing-btn-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.timing-btn-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timing-btn-desc {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-align: center;
}

.error-message {
    padding: 16px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    margin-top: 16px;
}

.auto-fill-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(52, 199, 89, 0.15);
    color: var(--accent-green);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(52, 199, 89, 0);
    }
}

/* ===== Enhanced Mobile Responsive Design ===== */

/* Tablets and small laptops */
@media (max-width: 1024px) {
    .ticker-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 24px 16px;
        margin-bottom: 20px;
    }
    
    .logo {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .nav-tabs {
        gap: 8px;
        padding: 6px;
    }
    
    .nav-tab {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .ticker-search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .ticker-input,
    .ticker-search-btn {
        width: 100%;
    }
    
    .timing-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .timing-btn {
        padding: 16px 12px;
        min-height: 100px;
    }
    
    .ticker-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .dictionary-grid {
        grid-template-columns: 1fr;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header {
        padding: 20px 12px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .timing-selector {
        padding: 16px;
    }
    
    .timing-btn {
        padding: 14px 10px;
        min-height: 90px;
    }
    
    .timing-btn-icon {
        font-size: 1.6rem;
    }
    
    .timing-btn-label {
        font-size: 0.9rem;
    }
    
    .timing-btn-desc {
        font-size: 0.75rem;
    }
}
