/* ==========================================================================
   LDP Analyzer - Professional Trading Platform Styles
   ========================================================================== */

/* Root Variables - Compact Theme with Red Accents */
:root {
    --color-primary: #2563eb;
    --color-success: #059669;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --color-info: #2563eb;
    --color-red: #dc2626;
    --color-red-light: #ef4444;
    --color-red-dark: #b91c1c;
    --color-hot: #dc2626;
    --color-cold: #2563eb;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    
    /* Compact spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
}

/* Global Styles */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    font-size: 0.875rem; /* Smaller base font size */
    line-height: 1.4; /* Tighter line height */
}

/* Reduce default padding and margins for compact layout */
main {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

main > * {
    margin-bottom: 0.5rem !important;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Toast Notifications */
.toast {
    pointer-events: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 1rem;
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.dark .toast {
    background: #1e293b;
    border-color: #334155;
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Trade Tabs */
.trade-tab {
    background: transparent;
    color: #64748b;
    transition: all 0.2s ease;
}

.dark .trade-tab {
    color: #94a3b8;
}

.trade-tab.active {
    background: white;
    color: #0ea5e9;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .trade-tab.active {
    background: #334155;
    color: #38bdf8;
}

/* Contract Type Tabs */
.contract-tab {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.dark .contract-tab {
    background: #334155;
    color: #94a3b8;
    border-color: #475569;
}

.contract-tab.active {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
}

/* Live Digits Stream */
#liveDigitsStream {
    scrollbar-width: thin;
}

#liveDigitsStream::-webkit-scrollbar {
    height: 4px;
}

.digit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Digit Color Classes - Red theme for hot digits (0, 2, 6) */
.digit-0 { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #991b1b; border: 1px solid #dc2626; }
.digit-1 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }
.digit-2 { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #991b1b; border: 1px solid #dc2626; }
.digit-3 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }
.digit-4 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }
.digit-5 { background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%); color: #374151; border: 1px solid #6b7280; }
.digit-6 { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #991b1b; border: 1px solid #dc2626; }
.digit-7 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }
.digit-8 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }
.digit-9 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; border: 1px solid #3b82f6; }

.dark .digit-0 { background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%); color: #fecaca; border: 1px solid #dc2626; }
.dark .digit-1 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }
.dark .digit-2 { background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%); color: #fecaca; border: 1px solid #dc2626; }
.dark .digit-3 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }
.dark .digit-4 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }
.dark .digit-5 { background: linear-gradient(135deg, #374151 0%, #4b5563 100%); color: #d1d5db; border: 1px solid #6b7280; }
.dark .digit-6 { background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%); color: #fecaca; border: 1px solid #dc2626; }
.dark .digit-7 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }
.dark .digit-8 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }
.dark .digit-9 { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #bfdbfe; border: 1px solid #3b82f6; }

/* Trade Log Entries */
.trade-entry {
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.dark .trade-entry {
    background: #1e293b;
    border-color: #334155;
}

.trade-entry:hover {
    border-color: #0ea5e9;
    transform: translateX(4px);
}

.trade-entry.win {
    background: #f0fdf4;
    border-color: #22c55e;
}

.dark .trade-entry.win {
    background: #14532d;
    border-color: #16a34a;
}

.trade-entry.loss {
    background: #fef2f2;
    border-color: #ef4444;
}

.dark .trade-entry.loss {
    background: #7f1d1d;
    border-color: #dc2626;
}

/* Chart Containers */
.chart-container {
    transition: opacity 0.3s ease;
}

.chart-container.hidden {
    display: none;
}

/* Custom Input Styles */
input[type="number"],
input[type="text"],
select {
    transition: all 0.2s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.1);
}

/* Button Hover Effects */
button {
    transition: all 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button:not(:disabled):hover {
    transform: translateY(-1px);
}

button:not(:disabled):active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Signal Cards Animation */
#signal1Card,
#signal2Card,
#signal3Card {
    animation: fadeInUp 0.5s ease;
}

#signal2Card {
    animation-delay: 0.1s;
}

#signal3Card {
    animation-delay: 0.2s;
}

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

/* Section-Specific Loading Overlays */
#chartLoadingOverlay,
#analyticsLoadingOverlay {
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

#chartLoadingOverlay.hidden,
#analyticsLoadingOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Responsive Adjustments */

/* Header Stats Bar - Always visible, no scrolling */
header .bg-slate-50 {
    overflow: visible;
}

/* Quick Trade Buttons - Clean Style */
.quick-trade-btn {
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    will-change: transform;
}

.quick-trade-btn:not(:disabled) {
    cursor: pointer;
}

.quick-trade-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.2);
}

.quick-trade-btn:not(:disabled):active {
    transform: translateY(0);
}

/* Primary quick trade button (Signal 1) */
#signal1Status.quick-trade-btn {
    border-width: 0;
}

/* Secondary quick trade buttons (Signal 2 & 3) */
#signal2Status.quick-trade-btn,
#signal3Status.quick-trade-btn {
    border-width: 0;
}

/* Extra Compact Mobile Mode (Tablets) */
@media (max-width: 768px) {
    /* More compact padding for all cards */
    .bg-white, .dark\:bg-slate-800 {
        padding: 0.5rem !important;
    }
    
    /* Smaller text */
    h1 { font-size: 1rem !important; }
    h2 { font-size: 0.875rem !important; }
    h3 { font-size: 0.75rem !important; }
    
    /* Tighter spacing */
    .space-y-2 > * + * { margin-top: 0.375rem !important; }
    .space-y-3 > * + * { margin-top: 0.5rem !important; }
    .space-x-2 > * + * { margin-left: 0.375rem !important; }
    .space-x-3 > * + * { margin-left: 0.5rem !important; }
    
    /* Compact buttons */
    button {
        padding: 0.375rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Compact inputs */
    input, select {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Compact cards */
    .rounded-lg {
        border-radius: 0.5rem !important;
    }
    
    /* Reduce gaps */
    .gap-3 { gap: 0.5rem !important; }
    .gap-2 { gap: 0.375rem !important; }
    
    /* Compact signal cards */
    #signal1Card, #signal2Card, #signal3Card {
        padding: 0.5rem !important;
    }
    
    /* Smaller chart heights */
    .h-48 { height: 10rem !important; }
    #priceChart { height: 200px !important; min-height: 200px !important; }
    
    /* Compact stats */
    .text-sm { font-size: 0.75rem !important; }
    .text-xs { font-size: 0.625rem !important; }
}

@media (max-width: 640px) {
    .digit-badge {
        min-width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }
    
    .trade-entry {
        font-size: 0.75rem;
    }
}

/* Compact Stake Modify Buttons */
.stake-modify-btn,
.manual-stake-modify {
    transition: all 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.stake-modify-btn:hover,
.manual-stake-modify:hover {
    transform: scale(1.05);
}

/* Equal Height Containers */
@media (min-width: 1024px) {
    .lg\:col-span-8,
    .lg\:col-span-4 {
        display: flex;
        flex-direction: column;
    }
    
    .lg\:col-span-8 > div,
    .lg\:col-span-4 > div {
        flex: 1;
    }
}

/* Fixed Chart Container Height - Prevents resize on theme toggle */
.chart-container-fixed {
    min-height: 360px;
}

#priceChart {
    height: 240px !important;
    min-height: 240px !important;
    max-height: 240px !important;
}

/* Ensure Chart.js canvas doesn't change on theme toggle */
#priceChart canvas {
    height: 240px !important;
}

/* Pulse Animation for Live Indicators */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth Transitions for Theme Toggle */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Hide elements smoothly */
.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Professional Shadows */
.shadow-professional {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dark .shadow-professional {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.dark .badge-success {
    background: #064e3b;
    color: #6ee7b7;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.dark .badge-danger {
    background: #7f1d1d;
    color: #fca5a5;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.dark .badge-warning {
    background: #78350f;
    color: #fcd34d;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #1e293b 50%, #334155 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Professional Focus Styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Mobile Menu Dropdown */
#mobileMenuDropdown {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#mobileMenuDropdown a {
    transition: all 0.2s ease;
}

/* Footer Horizontal Scroll for Mobile */
footer .overflow-x-auto {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

footer .overflow-x-auto::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Ensure footer links stay in one line on mobile */
@media (max-width: 640px) {
    footer .flex {
        flex-wrap: nowrap !important;
    }
    
    footer .gap-x-4 {
        gap: 0.75rem;
    }
    
    footer .space-x-2 > * + * {
        margin-left: 0.35rem;
    }
    
    footer .text-xs {
        font-size: 0.65rem;
    }
    
    /* Header stats - ultra compact on mobile */
    header .bg-slate-50 .flex {
        gap: 0.25rem !important;
    }
    
    header .bg-slate-50 .flex > div {
        padding-left: 0.375rem !important;
        padding-right: 0.375rem !important;
        justify-content: center;
    }
    
    /* Center stats values when labels are hidden on mobile */
    header .bg-slate-50 #balanceDisplay,
    header .bg-slate-50 #profitDisplay,
    header .bg-slate-50 #loginIdDisplay {
        text-align: center;
        width: 100%;
    }
}

/* FAQ Modal Styles */
#faqModal {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#faqModal > div {
    animation: slideUp 0.3s ease-out;
}

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

.faq-question i {
    transition: transform 0.3s ease;
}

.faq-answer {
    transition: all 0.3s ease;
}

/* Smooth accordion animation */
.faq-item {
    transition: all 0.2s ease;
}

.faq-item:hover {
    transform: translateX(2px);
}

/* FAQ Modal scrollbar */
#faqModal .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

#faqModal .overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

#faqModal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark #faqModal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Login/Logout Button Styles - Ensure prominence on mobile */
#loginBtn,
#logoutBtn {
    min-width: 90px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    #loginBtn,
    #logoutBtn {
        padding: 0.625rem 2rem !important; /* py-2.5 px-8 */
        font-size: 0.9rem !important;
        min-width: 100px;
        font-weight: 600 !important;
    }
}

/* LDP Legacy Button - Highlighted and Glowing */
.ldp-legacy-btn {
    position: relative;
    animation: subtleGlow 2s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(5, 150, 105, 0.2);
}

.ldp-legacy-btn:hover {
    box-shadow: 0 0 8px rgba(5, 150, 105, 0.3);
    transform: translateY(-1px);
    animation: none;
}

.dark .ldp-legacy-btn {
    box-shadow: 0 0 5px rgba(5, 150, 105, 0.3);
}

.dark .ldp-legacy-btn:hover {
    box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
}

@keyframes subtleGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(5, 150, 105, 0.2);
    }
    50% {
        box-shadow: 0 0 8px rgba(5, 150, 105, 0.25);
    }
}

.dark .ldp-legacy-btn {
    animation: subtleGlowDark 2s ease-in-out infinite;
}

@keyframes subtleGlowDark {
    0%, 100% {
        box-shadow: 0 0 5px rgba(5, 150, 105, 0.3);
    }
    50% {
        box-shadow: 0 0 8px rgba(5, 150, 105, 0.35);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header,
    button,
    #loadingOverlay,
    #faqModal {
        display: none;
    }
}

