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

:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --secondary: #6366f1;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: #e2e8f0;
    --focus-ring: rgba(16, 185, 129, 0.4);
    --box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
}

/* Login-specific centering */
body:has(.login-container) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 1.25rem;
}

.login-card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.login-logo {
    margin-bottom: 2rem;
}
.login-logo img {
    height: 45px;
    object-fit: contain;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.login-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon .toggle-password {
    left: auto;
    right: 1rem;
    cursor: pointer;
    transition: color 0.3s;
}

.input-with-icon .toggle-password:hover {
    color: var(--primary);
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    background-color: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* 6-Digit Captcha/OTP Boxes */
.captcha-container {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.captcha-box {
    width: calc(100% / 6 - 0.5rem);
    aspect-ratio: 1 / 1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: #f8fafc;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.captcha-box:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.captcha-box.display-box {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: none;
    font-family: monospace;
    font-size: 1.75rem;
}

/* Buttons */
.btn {
    display: inline-block;
    width: 100%;
    padding: 0.85rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-align: center;
    margin-top: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Links */
.forgot-link {
    display: inline-block;
    color: var(--primary);
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
    margin-top: 1.5rem;
}
.forgot-link:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: left;
    font-size: 0.95rem;
}
.alert-danger {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #f87171;
}
.alert-success {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #10b981;
}

/* Dashboard Styles */
.dashboard-header {
    background: var(--bg-card);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 35px;
    height: 35px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.indices-scroll {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

.indices-scroll::-webkit-scrollbar {
    display: none;
}

.index-card {
    min-width: 150px;
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

.index-card h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.index-card .price {
    font-size: 1.1rem;
    font-weight: 700;
    display: block;
}

.index-card .change {
    font-size: 0.8rem;
    font-weight: 600;
}

.text-success { color: #10b981; }
.text-danger { color: #ef4444; }

.main-content {
    padding: 0 1rem 5rem 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.big-card {
    background: linear-gradient(135deg, var(--secondary), #4f46e5);
    color: white;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
}

.big-card-title {
    font-size: 0.9rem;
    opacity: 0.8;
}

.big-card-val {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stock-list {
    background: white;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.stock-row:last-child {
    border-bottom: none;
}

.stock-info h3 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
}

.stock-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stock-price {
    text-align: right;
}

.stock-price .price {
    font-weight: 700;
    display: block;
}

.stock-price .percent {
    font-size: 0.8rem;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 0.2rem;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item.active {
    color: var(--primary);
}

@media (min-width: 768px) {
    .login-container {
        max-width: 450px;
        padding: 2rem;
    }
    .main-content {
        max-width: 800px;
        margin: 0 auto;
    }
}

/* ══ Mobile Phone Responsive Fixes ══ */
@media (max-width: 480px) {
    /* Login page */
    .login-container { padding: 1rem; }
    .login-card { padding: 1.75rem 1.25rem; }
    .login-card h2 { font-size: 1.25rem; }
    .captcha-box { font-size: 1.1rem; }
    .captcha-box.display-box { font-size: 1.3rem; }

    /* Dashboard header */
    .dashboard-header { padding: 0.85rem 0.75rem; }
    .header-top { gap: 0.5rem; }
    .user-profile { gap: 0.5rem; }

    /* Index cards scroll strip */
    .indices-strip { padding: 0 0.75rem 0.25rem; gap: 0.4rem; }
    .idx-card { min-width: 120px; padding: 0.65rem 0.75rem; }

    /* Main content */
    .main-content { padding: 0 0.75rem 5rem 0.75rem; }
    .sec-head { padding: 1rem 0.75rem 0.4rem; }

    /* Big card */
    .big-card { padding: 1.1rem; }
    .big-card-val { font-size: 1.45rem; }

    /* Trending options */
    .trending-options-wrap { padding: 1rem 0.75rem; }
    .trending-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .trending-header h2 { font-size: 1.1rem; }
    .trending-filters { gap: 0.5rem; }
    .filter-select { font-size: 0.78rem; padding: 0.4rem 0.55rem; }
    .type-toggle { flex-wrap: nowrap; }
    .toggle-btn { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

    /* Option chain table compact */
    .option-table-header { padding: 0 0.5rem 0.5rem 0.5rem; font-size: 0.7rem; }
    .option-row { padding: 0.75rem 0.5rem; }
    .option-name-cell .name { font-size: 0.82rem; }
    .ltp-cell .val { font-size: 0.9rem; }

    /* Bottom nav labels smaller */
    .nav-item span { font-size: 0.65rem; }
    .nav-item i { font-size: 1.1rem; }

    /* Stock list rows */
    .stock-row { padding: 0.75rem; }
    .stock-info h3 { font-size: 0.9rem; }
    .stock-info span { font-size: 0.72rem; }
    .stock-price .price { font-size: 0.9rem; }
    .stock-price .percent { font-size: 0.72rem; }

    /* Section title */
    .section-title { font-size: 0.95rem; margin: 1rem 0 0.75rem 0; }

    /* Header date input */
    .header-date-input { width: 110px; font-size: 0.75rem; }
}

/* Trending Options Section */
.trending-options-wrap {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.trending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.trending-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trending-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    background: #f8fafc;
    color: var(--text-main);
    cursor: pointer;
}

.type-toggle {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.toggle-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: white;
    color: var(--secondary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.option-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 0 1rem 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.option-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.2s;
}

.option-row:hover {
    background: #f8fafc;
}

.option-name-cell .name {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.2rem;
}

.option-name-cell .tags {
    display: flex;
    gap: 0.4rem;
}

.tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 0.2rem;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 700;
}

.oi-cell {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
}

.ltp-cell {
    text-align: right;
}

.ltp-cell .val {
    display: block;
    font-weight: 700;
    font-size: 1rem;
}

.ltp-cell .ch-perc {
    font-size: 0.75rem;
}

.loading-overlay {
    opacity: 0.5;
    pointer-events: none;
}

.header-date-input {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
    background: #f8fafc;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.header-date-input:focus {
    border-color: var(--primary);
}

@media (max-width: 480px) {
    .header-date-input {
        width: 120px;
        font-size: 0.8rem;
    }
}
