/* AlgoStreets Main Stylesheet */

:root {
    --primary-blue: #1E3A8A;
    --primary-blue-light: #2563EB;
    --secondary-teal: #0D9488;
    --accent-orange: #F59E0B;
    --danger-red: #EF4444;
    --success-green: #10B981;
    --warning-yellow: #FBBF24;
    --dark-gray: #1F2937;
    --medium-gray: #4B5563;
    --light-gray: #F3F4F6;
    --white: #FFFFFF;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --button-radius: 4px;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--dark-gray);
    line-height: 1.6;
    background-color: var(--light-gray);
    min-height: 100vh;
}

.mono {
    font-family: 'Roboto Mono', monospace;
}

/* Header */
header {
    background-color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 60px;
    flex-wrap: nowrap;
    gap: 1rem;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
    overflow: visible; /* Ensure nothing gets clipped */
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    line-height: 1.2; /* Give more space for descenders */
}

.logo-image {
    height: 32px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.logo-text {
    display: flex;
    align-items: baseline;
    font-size: inherit;
    line-height: 1.3; /* Extra space for g descender */
    padding-bottom: 2px; /* Small padding to ensure g doesn't clip */
}

.logo-text span {
    color: var(--secondary-teal);
}

.tagline {
    color: var(--medium-gray);
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-top: 0.15rem; /* Minimal space while preventing g cutoff */
    display: block;
    padding-left: 0; /* Align with logo image */
    white-space: nowrap;
}

/* Navigation - keeping original styles */
nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover, nav a.active {
    color: var(--primary-blue);
}

/* Desktop Navigation - for new structure */
.desktop-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.desktop-nav a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
    transition: color 0.3s;
}

.desktop-nav a:hover, .desktop-nav a.active {
    color: var(--primary-blue);
}

/* Ensure logo never breaks on any screen */
@supports (display: flex) {
    .logo {
        min-width: 0;
        overflow: hidden;
    }
    
    .logo-text {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-blue);
    padding: 0.5rem;
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: var(--white);
    box-shadow: -4px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.mobile-nav-header h3 {
    margin: 0;
    color: var(--primary-blue);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-logo-image {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--medium-gray);
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    border-bottom: 1px solid #E5E7EB;
}

.mobile-nav a {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
    transition: background-color 0.3s;
}

.mobile-nav a:hover {
    background-color: var(--light-gray);
    color: var(--primary-blue);
}

/* Mobile Menu Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Chart Containers - Fixed Height */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin: 1rem 0;
}

canvas {
    max-height: 400px !important;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--button-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    border: none;
}

.btn-primary {
    background: transparent;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
}

.btn-primary:hover {
    background: rgba(30, 58, 138, 0.05);
    color: var(--primary-blue);
}

.btn-secondary {
    background: var(--secondary-teal);
    color: var(--white);
}

.btn-secondary:hover {
    background: #0A7A6F;
}

.btn-outline {
    background: var(--white);
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
}

.btn-outline:hover {
    background: rgba(30, 58, 138, 0.05);
}

.btn-danger {
    background: var(--danger-red);
    color: var(--white);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-gray);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #E5E7EB;
    border-radius: var(--button-radius);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.form-text {
    font-size: 0.875rem;
    color: var(--medium-gray);
    margin-top: 0.25rem;
}

.form-error {
    color: var(--danger-red);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--button-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.alert-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning-yellow);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--light-gray);
}

th, td {
    padding: 1rem;
    text-align: left;
    white-space: nowrap;
}

th {
    font-weight: 500;
    color: var(--medium-gray);
    font-size: 0.875rem;
}

tbody tr {
    border-bottom: 1px solid #E5E7EB;
}

tbody tr:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

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

.stat-title {
    font-weight: 500;
    font-size: 1rem;
    color: var(--medium-gray);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 0.5rem;
}

.stat-value.positive {
    color: var(--success-green);
}

.stat-value.negative {
    color: var(--danger-red);
}

.stat-change {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success-green);
}

.stat-change.negative {
    color: var(--danger-red);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-red);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning-yellow);
}

.badge-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
}

.badge-secondary {
    background: var(--light-gray);
    color: var(--medium-gray);
}

/* Hero Section */
.hero {
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #1E3A8A 0%, #0D9488 100%);
    color: var(--white);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.25rem;
    max-width: 800px;
    margin: 0 auto 2rem;
}

/* Grid Layouts */
.two-column {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.three-column {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Footer */
footer {
    background: var(--dark-gray);
    color: var(--white);
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-logo h3 {
    margin: 0;
    font-size: 1.125rem;
}

.footer-logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #D1D5DB;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9CA3AF;
    font-size: 0.875rem;
}

.registration-details {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #9CA3AF;
    line-height: 1.6;
}

.registration-details p {
    margin: 0.25rem 0;
}

.registration-details p:first-child {
    font-weight: 600;
    color: #D1D5DB;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    right: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    top: 100%;
    margin-top: 5px;
}

.dropdown-menu a {
    color: black;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
}

.dropdown-menu a:hover {
    background-color: #f1f1f1;
}

.dropdown-item {
    color: black;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
}

.dropdown-item:hover {
    background-color: #f1f1f1;
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid #e9ecef;
}

.text-danger {
    color: var(--danger-red) !important;
}

.text-success {
    color: var(--success-green) !important;
}

/* Trade Row Highlighting */
tr.trade-row-positive,
tbody tr.trade-row-positive {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

tr.trade-row-negative,
tbody tr.trade-row-negative {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

tr.trade-row-positive:hover,
tbody tr.trade-row-positive:hover {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

tr.trade-row-negative:hover,
tbody tr.trade-row-negative:hover {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

/* Responsive */
/* Medium screens */
@media (max-width: 1200px) {
    header {
        padding: 1rem 1.5rem;
    }
    
    .desktop-nav ul {
        gap: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .two-column {
        grid-template-columns: 1fr;
    }

    .three-column {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Adjust logo for tablets */
    .logo {
        font-size: 1.375rem;
    }
    
    .logo-image {
        height: 28px;
    }
    
    .tagline {
        padding-left: 0;
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    nav, .desktop-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }
    
    /* Mobile logo adjustments */
    .logo-container {
        flex: 1;
        min-width: 0; /* Allow shrinking */
    }
    
    .logo {
        font-size: 1.25rem;
        gap: 0.375rem;
    }
    
    .logo-image {
        height: 24px;
    }
    
    .tagline {
        font-size: 0.55rem;
        padding-left: 0;
        letter-spacing: 0.03em;
    }

    .container, .dashboard-container {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .footer-logo-image {
        height: 32px;
    }
    
    .registration-details {
        font-size: 0.7rem;
        padding: 0 1rem;
    }
    
    .registration-details p:first-child {
        font-size: 0.8rem;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .chart-container {
        height: 300px;
    }

    canvas {
        max-height: 300px !important;
    }

    /* Mobile specific button styles */
    .btn {
        padding: 0.5rem 1rem;
    }

    /* Make cards stack better on mobile */
    .card {
        margin-bottom: 1rem;
    }

    /* Adjust form elements for mobile */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Floating WhatsApp Button */
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float i {
        font-size: 24px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    header {
        padding: 0.5rem 0.75rem;
    }
    
    .logo {
        font-size: 1.125rem;
    }
    
    .logo-image {
        height: 20px;
    }
    
    .logo-text {
        font-size: 1.125rem;
    }
    
    .tagline {
        font-size: 0.5rem;
        padding-left: 0;
        display: none; /* Hide on very small screens */
    }
    
    /* Show tagline only on larger screens */
    @media (min-width: 360px) {
        .tagline {
            display: block;
        }
    }
    
    .mobile-logo-image {
        height: 24px;
    }
    
    .footer-logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .footer-logo-image {
        height: 28px;
    }
}

/* Floating WhatsApp Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    background: #20BA5C;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.whatsapp-float i {
    font-size: 30px;
}

/* Mobile adjustments for WhatsApp button */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float i {
        font-size: 24px;
    }
}