/* ============================================
   Itô Markets — Midnight Suite Theme
   Mobile-First Responsive Design
   Navy background, gold accents, institutional fonts
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Mono:wght@300;400;500&family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600&display=swap');

:root {
    /* Colors — The Midnight Suite */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --border: #1E293B;
    --border-hover: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #64748B;
    --text-tertiary: #475569;
    --text-muted: #475569;
    --success: #B5A172;
    --danger: #EF4444;
    --accent-green: #B5A172;
    --accent-red: #EF4444;
    --accent-yellow: #C0A062;

    /* Brand Colors */
    --ito-navy: #0F172A;
    --ito-slate: #64748B;
    --ito-white: #F8FAFC;
    --ito-gold: #B5A172;
    --ito-border: #1E293B;

    /* Fonts */
    --serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing - Fluid scaling */
    --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-sm: clamp(0.5rem, 1vw, 0.75rem);
    --space-md: clamp(0.75rem, 1.5vw, 1rem);
    --space-lg: clamp(1rem, 2vw, 1.5rem);
    --space-xl: clamp(1.5rem, 3vw, 2rem);
    --space-2xl: clamp(2rem, 4vw, 3rem);

    /* Touch targets */
    --touch-target-min: 44px;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    line-height: 1.6;
    padding-top: 70px;
    touch-action: manipulation;
}

/* ============================================
   HEADER - Responsive & Touch-Friendly
   ============================================ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    min-height: 70px;
}

.logo {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.08em;
    min-height: var(--touch-target-min);
}

.logo::before {
    display: none;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.nav-links {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    transition: color 0.2s;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(248, 250, 252, 0.05);
}

/* ============================================
   BUTTONS - Touch-Friendly
   ============================================ */
.btn {
    padding: var(--space-md) var(--space-lg);
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-weight: 500;
    border: 1px solid var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    white-space: nowrap;
}

.btn:hover {
    background: transparent;
    color: var(--text-primary);
    transform: translateY(-1px);
}

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

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

.btn-outline:hover {
    border-color: var(--text-primary);
    background: rgba(248, 250, 252, 0.05);
}

.btn-nav {
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid rgba(30, 41, 59, 0.5);
    border-radius: var(--radius-md);
    background: rgba(30, 41, 59, 0.4);
    color: var(--text-primary);
    text-decoration: none;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 300;
    transition: all 0.2s ease;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-nav:hover {
    border-color: rgba(51, 65, 85, 0.5);
    background: rgba(30, 41, 59, 0.6);
}

/* ============================================
   TYPOGRAPHY - Fluid Scaling
   ============================================ */
.mono {
    font-family: var(--mono);
}

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

h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
}

/* ============================================
   CONTAINER - Responsive Padding
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg) var(--space-xl);
    width: 100%;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: var(--space-lg);
    transition: all 0.3s;
    border-radius: var(--radius-lg);
}

.card:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
}

/* ============================================
   TABLES - Horizontal Scroll on Mobile
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--space-lg) 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    margin-top: var(--space-2xl);
    padding: var(--space-xl) var(--space-lg);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-xl);
}

.footer-brand h3 {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    line-height: 1.6;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-links h4 {
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--mono);
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: clamp(0.8rem, 1.8vw, 0.85rem);
    transition: color 0.2s;
    padding: var(--space-xs) 0;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

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

.footer-copyright {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 1.8vw, 0.8rem);
    font-family: var(--mono);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

.text-center {
    text-align: center;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small phones: 480px and below */
@media (max-width: 480px) {
    body {
        padding-top: 60px;
        font-size: 14px;
    }

    header {
        padding: var(--space-sm) var(--space-md);
        min-height: 60px;
    }

    .container {
        padding: var(--space-xl) var(--space-md) var(--space-lg);
    }

    .header-actions {
        gap: var(--space-xs);
    }

    .nav-links {
        gap: var(--space-xs);
    }

    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
    }

    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }
}

/* Tablets portrait: 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: var(--space-2xl) var(--space-lg) var(--space-xl);
    }
}

/* Tablets landscape and small desktops: 769px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

/* Medium desktops: 1025px to 1200px */
@media (min-width: 1025px) and (max-width: 1200px) {
    .container {
        max-width: 1000px;
    }
}

/* Large desktops: 1201px and above */
@media (min-width: 1201px) {
    .container {
        max-width: 1200px;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    header {
        padding: var(--space-md);
        flex-wrap: wrap;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: var(--space-xs) var(--space-sm);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets on touch devices */
    .btn,
    .btn-outline,
    .btn-nav {
        min-height: 48px;
        padding: var(--space-md) var(--space-lg);
    }

    .nav-links a {
        min-height: 48px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .btn-outline:hover,
    .card:hover {
        transform: none;
    }
}
/* ============================================
   ORDER BOOK SUMMARY COMPONENT
   ============================================ */

.order-book-summary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.order-book-summary .price-value {
    font-family: var(--mono);
    font-weight: 600;
}

.order-book-summary .price-value.bid {
    color: var(--accent-green);
}

.order-book-summary .price-value.ask {
    color: var(--accent-red);
}

.order-book-summary .spread-indicator {
    font-family: var(--mono);
    font-weight: 600;
}

.order-book-summary .spread-indicator.spread-good {
    color: var(--accent-green);
}

.order-book-summary .spread-indicator.spread-medium {
    color: var(--accent-yellow);
}

.order-book-summary .spread-indicator.spread-wide {
    color: var(--accent-red);
}

/* Execution Preference Checkbox */
.execution-preference input[type="checkbox"] {
    accent-color: var(--accent-green);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .order-book-summary {
        padding: var(--space-sm);
        margin-bottom: var(--space-sm);
    }
}

/* ============================================
   TUTORIAL MODAL BASE STYLES
   ============================================ */

/* Modal overlay - darkens background */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

/* Tutorial spotlight overlay */
.tutorial-spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Main modal container */
.modal {
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10001;
}

/* Modal header */
.modal-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

/* Tutorial progress indicator */
.tutorial-progress {
    flex: 1;
}

.tutorial-progress > span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-family: var(--mono);
}

.tutorial-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(248, 250, 252, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.tutorial-progress-fill {
    height: 100%;
    background: var(--ito-gold);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Close button */
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(248, 250, 252, 0.1);
    color: var(--text-primary);
}

/* Modal body */
.modal-body {
    padding: 2rem;
}

.tutorial-title {
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tutorial-description {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
}

.tutorial-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Modal footer */
.modal-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.modal-footer .btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--sans);
}

.modal-footer .btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.modal-footer .btn-secondary:hover:not(:disabled) {
    background: rgba(248, 250, 252, 0.05);
    color: var(--text-primary);
}

.modal-footer .btn-green {
    background: var(--ito-gold);
    border-color: var(--ito-gold);
    color: #0F172A;
    font-weight: 500;
}

.modal-footer .btn-green:hover:not(:disabled) {
    background: #C0A062;
    border-color: #C0A062;
}

.modal-footer .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tutorial highlight effect on target elements */
.tutorial-highlighted {
    position: relative;
    z-index: 10000;
    box-shadow: 0 0 0 4px rgba(181, 161, 114, 0.3),
                0 0 20px rgba(181, 161, 114, 0.2);
    border-radius: 4px;
}

/* Animated droplet pointer */
.tutorial-droplet {
    animation: tutorial-pulse 2s infinite;
}

@keyframes tutorial-pulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-10px);
        opacity: 0.7;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal {
        max-width: 95%;
        width: 95%;
    }

    .modal-header {
        padding: 1rem 1.5rem 0.75rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 0.75rem 1.5rem 1rem;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .tutorial-title {
        font-size: 1.5rem;
    }
}

/* ============================================
   TUTORIAL ACCOUNT TYPE SELECTION
   ============================================ */

/* Full-width modal for account selection */
.tutorial-modal.full-width {
    max-width: 900px;
    width: 90%;
}

/* Account type cards grid */
.tutorial-account-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Individual account card */
.tutorial-account-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(30, 41, 59, 0.5);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-align: center;
}

.tutorial-account-card:hover,
.tutorial-account-card.selected {
    border-color: var(--ito-gold);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(181, 161, 114, 0.15);
}

.tutorial-account-card.recommended {
    border-color: var(--ito-gold);
}

.tutorial-account-card.recommended:hover,
.tutorial-account-card.recommended.selected {
    border-color: var(--ito-gold);
    box-shadow: 0 12px 40px rgba(181, 161, 114, 0.2);
}

/* Quick start badge */
.quick-start-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--ito-gold);
    color: #0F172A;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card icon */
.tutorial-account-card .option-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Card title */
.tutorial-account-card h3 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Card description */
.tutorial-account-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Benefits list */
.tutorial-account-card .benefits-list {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-bottom: 1rem;
}

.tutorial-account-card .benefits-list li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.tutorial-account-card .benefits-list li::before {
    content: "\2713";
    color: var(--ito-gold);
    font-weight: 600;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Credit badge */
.tutorial-account-card .credit-badge {
    background: var(--ito-gold);
    color: #0F172A;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: inline-block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tutorial-account-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tutorial-modal.full-width {
        width: 95%;
        padding: 1.5rem;
    }
}
