/* =========================================================
   KinoSim Modern App UI
   Complete Stylesheet
   ========================================================= */

/* =========================================================
   Design Tokens / Theme Variables
   Central place for application colors, spacing and shadows
   ========================================================= */

:root {
    /* Main background colors */
    --bg: #07111f;
    --bg-soft: #0f1f35;

    /* Card and surface colors */
    --card: #ffffff;
    --card-soft: #f8fafc;

    /* Text colors */
    --text: #101827;
    --muted: #64748b;

    /* Primary blue palette */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;

    /* Yellow accent palette */
    --accent: #facc15;
    --accent-dark: #eab308;

    /* Status colors */
    --green: #16a34a;
    --green-soft: #dcfce7;

    --red: #dc2626;
    --red-soft: #fee2e2;

    --orange: #f97316;
    --purple: #7c3aed;

    /* Borders and effects */
    --border: #e2e8f0;

    --shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    --shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.08);

    /* Common rounded corners */
    --radius: 18px;
    --radius-sm: 12px;
}

/* =========================================================
   Base Reset / Document Setup
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);

    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 32rem),
        radial-gradient(circle at top right, rgba(250, 204, 21, 0.14), transparent 28rem),
        linear-gradient(180deg, #07111f 0%, #0f172a 230px, #f1f5f9 231px, #f8fafc 100%);
}

button,
input,
select {
    font-family: inherit;
}

button {
    cursor: pointer;
}

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

a {
    color: inherit;
}

/* =========================================================
   Header / Top Navigation
   Desktop header contains the logo and four main menu links
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;

    color: white;

    padding: 10px 22px;

    background:
        linear-gradient(
            135deg,
            rgba(37, 99, 235, 0.96),
            rgba(15, 23, 42, 0.98)
        ),
        radial-gradient(
            circle at 90% 0%,
            rgba(250, 204, 21, 0.24),
            transparent 24rem
        );

    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
}

/* Keeps the header contents aligned with the main page width */
.topbar-inner {
    width: min(1500px, 100%);
    margin: 0 auto;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
}

/* =========================================================
   Logo
   ========================================================= */

.brand-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;

    text-decoration: none;
}

/* Desktop logo sizing */
.brand-logo img {
    display: block;

    width: min(315px, 90vw);
    max-height: 90px;
    height: auto;

    object-fit: contain;

    margin-left: -12px;
}

/* =========================================================
   Desktop Navigation Menu
   Now contains four items:
   Προβλέψεις, Στρατηγικές, Στατιστικά, Προσωπικό Δελτίο
   ========================================================= */

.main-nav {
    flex: 1 1 auto;

    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;

    margin: 0;
}

/* Individual desktop navigation link */
.main-nav a {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 1 1 175px;
    max-width: 230px;
    min-height: 54px;

    padding: 10px 16px;

    color: white;
    text-decoration: none;

    border-radius: 18px;

    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.14);

    backdrop-filter: blur(10px);

    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

/* Hover state for non-selected and selected links */
.main-nav a:hover {
    transform: translateY(-2px);

    background: rgba(255, 255, 255, 0.17);
    border-color: rgba(255, 255, 255, 0.26);
}

/* Currently selected page */
.main-nav a.active {
    color: #111827;

    background:
        linear-gradient(
            135deg,
            #facc15,
            #fbbf24
        );

    border-color: rgba(250, 204, 21, 0.95);

    box-shadow:
        0 8px 22px rgba(250, 204, 21, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Text displayed inside each desktop menu button */
.nav-title {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    letter-spacing: -0.02em;
}

/* =========================================================
   Mobile Current Page Title
   Hidden on desktop.
   Displayed at the top of the page on phones/tablets.
   Descriptions have been removed, so this only contains h1.
   ========================================================= */

.mobile-page-intro {
    display: none;
}

/* =========================================================
   Main Page Layout
   ========================================================= */

.container {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 22px;
}

/* White content panel used across application pages */
.card {
    margin-bottom: 18px;
    padding: 20px;

    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

/* Main card headings */
.card h2 {
    margin: 0 0 14px;

    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.03em;
}

/* Secondary card headings */
.card h3 {
    margin-top: 18px;
    margin-bottom: 10px;

    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

/* Supporting or explanatory text */
.muted {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

/* =========================================================
   Forms / Controls
   ========================================================= */

.controls,
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;

    margin-bottom: 14px;
}

/* Form label styling */
label {
    display: flex;
    flex-direction: column;
    gap: 6px;

    color: #334155;

    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Text inputs, dates, numbers and select dropdowns */
input,
select {
    min-height: 40px;

    padding: 9px 11px;

    color: var(--text);
    background: white;

    border: 1px solid var(--border);
    border-radius: 12px;

    font-size: 14px;
    outline: none;

    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);

    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

/* Keyboard and input focus state */
input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

/* Default button appearance */
button {
    min-height: 40px;

    padding: 9px 14px;

    color: #111827;
    background: #e2e8f0;

    border: 0;
    border-radius: 12px;

    font-size: 14px;
    font-weight: 900;

    box-shadow: 0 2px 0 rgba(15, 23, 42, 0.10);

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 0 rgba(15, 23, 42, 0.12);
}

/* Main action buttons used on different application pages */
#applyBtn,
#predictionBtn,
#backtestBtn,
#analyticsBtn,
#customBacktestBtn,
.strategy-add-btn {
    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
}

/* Clear / reset buttons */
#clearBtn,
#clearTicketBtn {
    color: #334155;
    background: #f1f5f9;

    border: 1px solid var(--border);
}

/* Previous and next draw navigation buttons */
.pager button {
    color: white;
    background: linear-gradient(135deg, #111827, #1e293b);
}

/* Strategy buttons shown in the custom ticket builder */
.strategy-add-btn {
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* =========================================================
   Informational Text / Error Messages
   ========================================================= */

.info {
    margin: 10px 0 14px;

    color: #475569;

    font-size: 14px;
    line-height: 1.55;
}

.info strong {
    color: #0f172a;
}

.error {
    color: var(--red);
    font-weight: 900;
}

/* =========================================================
   Tables
   Used for draw history and backtest results
   ========================================================= */

.table-wrapper {
    overflow: auto;

    max-height: 650px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 14px;
}

table {
    width: 100%;

    border-collapse: separate;
    border-spacing: 0;

    white-space: nowrap;

    font-size: 13px;
}

th,
td {
    padding: 9px 8px;

    text-align: center;

    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #eef2f7;
}

th:last-child,
td:last-child {
    border-right: 0;
}

tr:last-child td {
    border-bottom: 0;
}

/* Sticky table header remains visible while scrolling results */
th {
    position: sticky;
    top: 0;
    z-index: 3;

    color: #334155;

    background: linear-gradient(180deg, #f8fafc, #eef2ff);

    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Alternating row background for readability */
tbody tr:nth-child(even) {
    background: #f8fafc;
}

/* Highlight row under the pointer */
tbody tr:hover {
    background: #eff6ff;
}

/* Draw number values shown inside tables */
.number-cell {
    color: #1d4ed8;
    font-weight: 900;
}

/* =========================================================
   Number Badges / Pills
   ========================================================= */

.badge-box {
    min-height: 42px;
}

/* Standard number badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 34px;

    margin: 3px;
    padding: 7px 10px;

    color: #111827;
    background: #e5e7eb;

    border: 1px solid #d1d5db;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

/* Numbers generated by a prediction strategy */
.badge.prediction {
    color: white;
    background: linear-gradient(135deg, #2563eb, #3b82f6);

    border-color: #1d4ed8;

    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.28);
}

/* Frequently occurring numbers */
.badge.common {
    color: #166534;
    background: var(--green-soft);

    border-color: #86efac;
}

/* Missing or cold numbers */
.badge.missing {
    color: #991b1b;
    background: var(--red-soft);

    border-color: #fca5a5;
}

/* Numbers that match a tested result */
.badge.match {
    color: #111827;
    background: linear-gradient(135deg, var(--accent), #fde047);

    border-color: var(--accent-dark);

    box-shadow: 0 5px 14px rgba(250, 204, 21, 0.32);
}

/* Suggested numbers that may be clicked in the builder */
.suggested-number {
    min-height: 36px;
    border-radius: 999px;
}

/* =========================================================
   Statistics / Analytics Layout
   ========================================================= */

.stats-grid,
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;

    margin-top: 16px;
}

/* Separate result blocks from surrounding data */
.analytics-block,
.sample-block {
    margin-top: 22px;
    padding-top: 18px;

    border-top: 1px solid var(--border);
}

.analytics-block h3,
.sample-block h3 {
    margin-bottom: 10px;
}

/* Positive profit / result indicator */
.profit-positive {
    color: var(--green);
    font-weight: 900;
}

/* Negative profit / result indicator */
.profit-negative {
    color: var(--red);
    font-weight: 900;
}

/* =========================================================
   KINO Ticket Builder
   ========================================================= */

.ticket-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;

    margin: 12px 0;
}

/* Grid containing the 80 available KINO numbers */
.kino-ticket {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 9px;

    max-width: 820px;

    margin-top: 12px;
    padding: 14px;

    background: linear-gradient(180deg, #f8fafc, #eef2ff);

    border: 1px solid #dbeafe;
    border-radius: 22px;

    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Individual selectable ticket number */
.ticket-number {
    padding: 10px 0;

    color: #0f172a;
    background: white;

    border: 1px solid #cbd5e1;
    border-radius: 999px;

    text-align: center;
    font-weight: 900;

    cursor: pointer;
    user-select: none;

    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);

    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease,
        box-shadow 0.16s ease;
}

/* Hovered ticket number */
.ticket-number:hover {
    background: #dbeafe;
    border-color: #93c5fd;

    transform: translateY(-1px);
}

/* Currently selected ticket number */
.ticket-number.selected {
    color: white;

    background: radial-gradient(circle at 35% 25%, #60a5fa, #2563eb 70%);

    border-color: #1d4ed8;

    box-shadow:
        0 8px 18px rgba(37, 99, 235, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Locked number when ticket maximum has been reached */
.ticket-number.locked {
    opacity: 0.45;
}

/* =========================================================
   Stake Preset Buttons
   ========================================================= */

.stake-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: end;
}

.stake-preset {
    padding: 9px 12px;

    color: #111827;
    background: linear-gradient(135deg, var(--accent), #fde047);

    border-radius: 999px;
}

/* =========================================================
   Tablet / Mobile Layout
   Breakpoint: screens up to 900px wide
   ========================================================= */

@media (max-width: 900px) {

    body {
        /*
         * Extra space at the bottom prevents page content
         * from being hidden behind the fixed mobile menu.
         */
        padding-bottom: 92px;

        background:
            radial-gradient(circle at top left, rgba(37, 99, 235, 0.20), transparent 24rem),
            linear-gradient(180deg, #07111f 0%, #0f172a 180px, #f8fafc 181px, #f8fafc 100%);
    }

    /* =====================================================
       Mobile Header
       Logo and active page title remain at the top.
       The navigation itself moves to the bottom.
       ===================================================== */

    .topbar {
        position: static;

        padding: 14px 14px 16px;

        border-bottom-left-radius: 24px;
        border-bottom-right-radius: 24px;
    }

    .topbar-inner {
        width: 100%;

        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Smaller logo for phone and tablet screens */
    .brand-logo img {
        width: min(255px, 82vw);
        max-height: 70px;

        margin-left: -8px;
    }

    /*
     * Current active page title.
     * The old short description has been removed,
     * so this is now a simple title card.
     */
    .mobile-page-intro {
        display: block;

        width: 100%;

        padding: 12px 16px;

        color: white;
        background: rgba(255, 255, 255, 0.10);

        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 16px;

        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);

        backdrop-filter: blur(10px);
    }

    .mobile-page-intro h1 {
        margin: 0;

        color: white;

        font-size: 22px;
        font-weight: 900;
        line-height: 1.15;
        letter-spacing: -0.04em;
    }

    /* =====================================================
       Mobile Bottom Navigation
       Four menu options remain after removing draws.php.
       ===================================================== */

    .main-nav {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 100;

        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;

        margin: 0;
        padding: 8px;

        background: rgba(15, 23, 42, 0.92);

        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 22px;

        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);

        backdrop-filter: blur(18px);
    }

    /* Compact app-style mobile navigation button */
    .main-nav a {
        min-width: 0;
        min-height: 56px;
        max-width: none;

        padding: 7px 4px;

        flex-direction: column;

        color: rgba(255, 255, 255, 0.78);
        background: transparent;

        border: 0;
        border-radius: 17px;

        box-shadow: none;
    }

    /*
     * Keep menu titles accessible to screen readers
     * while hiding them visually in the icon-only mobile menu.
     */
    .main-nav .nav-title {
        position: absolute;

        width: 1px;
        height: 1px;

        padding: 0;
        margin: -1px;

        overflow: hidden;

        white-space: nowrap;

        border: 0;

        clip-path: inset(50%);
    }

    /* Shared icon styling for mobile menu items */
    .main-nav a::before {
        display: block;

        font-size: 23px;
        line-height: 1;

        margin-bottom: 2px;
    }

    /*
     * Menu icon mapping after removal of draws.php:
     * 1 = Έξυπνες Προβλέψεις
     * 2 = Δοκιμή Στρατηγικών
     * 3 = Στατιστικά & Τάσεις
     * 4 = Προσωπικό Δελτίο
     */
    .main-nav a:nth-child(1)::before {
        content: "✨";
    }

    .main-nav a:nth-child(2)::before {
        content: "🧪";
    }

    .main-nav a:nth-child(3)::before {
        content: "📊";
    }

    .main-nav a:nth-child(4)::before {
        content: "🎫";
    }

    /* Selected menu item in the bottom application bar */
    .main-nav a.active {
        color: #111827;
        background: linear-gradient(135deg, var(--accent), #fde047);

        box-shadow: 0 8px 18px rgba(250, 204, 21, 0.28);
    }

    .main-nav a.active::before {
        transform: scale(1.06);
    }

    /* =====================================================
       Mobile Content Adjustments
       ===================================================== */

    .container {
        padding: 14px;
    }

    .card {
        margin-bottom: 14px;
        padding: 16px;

        border-radius: 20px;

        box-shadow: var(--shadow-soft);
    }

    .card h2 {
        font-size: 20px;
    }

    .controls,
    .pager {
        gap: 10px;
    }

    label {
        width: 100%;
    }

    input,
    select {
        width: 100%;
        min-height: 44px;

        font-size: 15px;
    }

    .controls button,
    .pager button {
        flex: 1 1 auto;
        min-height: 44px;
    }

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

    .table-wrapper {
        max-height: 520px;
        border-radius: 16px;
    }

    th,
    td {
        padding: 8px 7px;
    }

    .badge {
        min-width: 36px;

        padding: 8px 10px;

        font-size: 13px;
    }

    .kino-ticket {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;

        padding: 12px;

        border-radius: 20px;
    }

    .ticket-number {
        padding: 11px 0;

        font-size: 15px;
    }

    .stake-presets {
        width: 100%;
    }

    .stake-preset {
        flex: 1 1 auto;
    }
}

/* =========================================================
   Small Phones
   Additional refinements for screens up to 420px wide
   ========================================================= */

@media (max-width: 420px) {

    .topbar {
        padding: 12px 10px 14px;
    }

    .brand-logo img {
        width: min(225px, 78vw);
        max-height: 62px;
    }

    .mobile-page-intro {
        padding: 11px 13px;
        border-radius: 15px;
    }

    .mobile-page-intro h1 {
        font-size: 20px;
    }

    .container {
        padding: 10px;
    }

    .card {
        padding: 14px;
    }

    .kino-ticket {
        grid-template-columns: repeat(5, 1fr);
        gap: 7px;
    }

    .ticket-number {
        padding: 10px 0;

        font-size: 14px;
    }

    .main-nav {
        left: 8px;
        right: 8px;
        bottom: 8px;

        padding: 7px;

        border-radius: 20px;
    }

    .main-nav a {
        min-height: 52px;
        border-radius: 15px;
    }

    .main-nav a::before {
        font-size: 21px;
    }
}

/* =========================================================
   Prediction Page - Time Window Filter & Strategy Results
   =========================================================
   These styles support the new prediction page interface:
   - Half-hour draw selection window
   - Recent-draw buffer
   - Dynamic explanation panel
   - Results from all prediction strategies
   ========================================================= */

/* =========================================================
   Shared Heading Layout
   Used at the top of the prediction filter section
   ========================================================= */

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;

    margin-bottom: 20px;
}

.section-heading h2 {
    margin-bottom: 8px;
}

.section-heading .muted {
    max-width: 820px;
    margin: 0;
}

/* Small badge explaining that analysis is limited
   to the latest five hours of available draws */
.time-limit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;

    padding: 9px 14px;

    color: #1e3a8a;
    background: var(--primary-soft);

    border: 1px solid #93c5fd;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

/* =========================================================
   Time Window Filter Panel
   ========================================================= */

.time-window-filter {
    margin-bottom: 22px;
    padding: 18px;

    background:
        linear-gradient(
            135deg,
            rgba(239, 246, 255, 0.95),
            rgba(248, 250, 252, 0.98)
        );

    border: 1px solid #dbeafe;
    border-radius: 20px;
}

/* Two filter fields displayed next to each other on desktop */
.time-window-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 16px;

    margin-bottom: 18px;
}

/* Individual numbered filter box */
.time-window-field {
    position: relative;

    display: flex;
    flex-direction: column;
    gap: 10px;

    min-height: 152px;

    padding: 16px 16px 14px 58px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

/* Round step indicator: 1 and 2 */
.time-window-step {
    position: absolute;
    top: 16px;
    left: 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);

    border-radius: 999px;

    font-size: 14px;
    font-weight: 900;

    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.24);
}

/* Let filter labels use normal sentence formatting,
   instead of the global uppercase form-label style */
.time-window-field label {
    display: flex;
    flex-direction: column;
    gap: 8px;

    color: #0f172a;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;

    text-transform: none;
    letter-spacing: normal;
}

/* Full-width dropdowns inside filter boxes */
.time-window-field select {
    width: 100%;
    min-height: 46px;

    margin-top: 2px;

    color: #0f172a;
    background: #ffffff;

    font-size: 15px;
    font-weight: 700;
}

/* Supporting explanation underneath each field */
.field-help {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
}

/* =========================================================
   Selected Time Window Explanation
   ========================================================= */

.time-window-preview {
    margin-bottom: 14px;
    padding: 16px 18px;

    color: #1e293b;

    background:
        linear-gradient(
            135deg,
            rgba(219, 234, 254, 0.72),
            rgba(239, 246, 255, 0.92)
        );

    border: 1px solid #bfdbfe;
    border-radius: 16px;
}

/* Small heading inside the preview box */
.time-window-preview-title {
    margin-bottom: 8px;

    color: #1d4ed8;

    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Main preview sentence */
.time-window-preview p {
    margin: 0 0 8px;

    color: #334155;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
}

.time-window-preview p:last-child {
    margin-bottom: 0;
}

/* Highlight the calculated start/end interval */
.time-window-preview strong {
    color: #0f172a;
    font-weight: 900;
}

/* Rule explanation shown under the dynamic interval */
.time-window-rule {
    color: #64748b !important;

    font-size: 13px !important;
    font-weight: 500 !important;
}

/* Validation error shown when window + buffer exceeds 5 hours */
.time-window-error {
    margin-bottom: 14px;
    padding: 12px 14px;

    color: #991b1b;
    background: var(--red-soft);

    border: 1px solid #fca5a5;
    border-radius: 12px;

    font-size: 14px;
    font-weight: 800;
    line-height: 1.45;
}

/* Ensure HTML hidden attribute always hides the message */
.time-window-error[hidden] {
    display: none;
}

/* =========================================================
   Time Window Action Buttons
   ========================================================= */

.time-window-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Main action for applying the selected draw interval */
#applyTimeWindowBtn {
    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
}

/* Secondary action for restoring the default interval */
#resetTimeWindowBtn {
    color: #334155;
    background: white;

    border: 1px solid var(--border);
}

/* =========================================================
   Selected Draws Heading
   ========================================================= */

.selected-draws-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;

    margin: 20px 0 12px;
}

.selected-draws-heading h3 {
    margin: 0;
}

.selected-draws-heading .info {
    margin: 0;
}

/* =========================================================
   All Predictions Toolbar
   ========================================================= */

.all-predictions-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;

    margin: 18px 0 14px;
    padding: 16px;

    background: var(--card-soft);

    border: 1px solid var(--border);
    border-radius: 16px;
}

/* Restore natural Greek sentence formatting for this label */
.all-predictions-toolbar label {
    color: #334155;

    font-size: 13px;
    font-weight: 900;

    text-transform: none;
    letter-spacing: normal;
}

/* Prediction count field does not need to be too wide */
.all-predictions-toolbar #predictionCount {
    width: 160px;
}

/* Main button for calculating every strategy */
.all-predictions-toolbar #predictionBtn {
    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
}

/* =========================================================
   Strategy Results Grid
   ========================================================= */

.strategy-results-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(270px, 1fr));
    gap: 14px;

    margin-top: 18px;
    margin-bottom: 22px;
}

/* Result card for one individual strategy */
.strategy-result-card {
    display: flex;
    flex-direction: column;

    min-height: 192px;

    padding: 16px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f8fafc
        );

    border: 1px solid var(--border);
    border-radius: 18px;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);

    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

/* Gentle hover state for strategy cards */
.strategy-result-card:hover {
    transform: translateY(-2px);

    border-color: #bfdbfe;

    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
}

/* Header containing strategy title and optional tag */
.strategy-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;

    margin-bottom: 8px;
}

.strategy-result-header h3 {
    margin: 0;

    color: #0f172a;

    font-size: 16px;
    font-weight: 900;
    line-height: 1.3;
}

/* Strategy information paragraph */
.strategy-description {
    flex: 1;

    margin: 0 0 14px;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.45;
}

/* Small strategy category tag */
.strategy-tag {
    display: inline-flex;
    align-items: center;

    padding: 5px 8px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

/* Neutral tag shown on the random comparison strategy */
.strategy-tag-neutral {
    color: #475569;
    background: #e2e8f0;

    border: 1px solid #cbd5e1;
}

/* Area where predicted number badges appear */
.strategy-prediction-result {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 2px;

    min-height: 42px;
}

/* Loading / no-result placeholder text */
.strategy-placeholder {
    display: inline-flex;
    align-items: center;

    min-height: 34px;

    color: #94a3b8;

    font-size: 13px;
    font-weight: 700;
    font-style: italic;
}

/* Give predicted badges slightly tighter spacing
   when they appear inside strategy cards */
.strategy-prediction-result .badge {
    margin: 2px;
}

/* =========================================================
   Summary Statistics Below Strategies
   ========================================================= */

.prediction-summary-grid {
    margin-top: 8px;
    padding-top: 20px;

    border-top: 1px solid var(--border);
}

/* =========================================================
   Tablet Layout
   Two strategy cards per row when space becomes limited
   ========================================================= */

@media (max-width: 1100px) {

    .strategy-results-grid {
        grid-template-columns: repeat(2, minmax(250px, 1fr));
    }
}

/* =========================================================
   Phone / Small Tablet Layout
   ========================================================= */

@media (max-width: 900px) {

    .section-heading {
        flex-direction: column;
        gap: 12px;

        margin-bottom: 16px;
    }

    .time-limit-badge {
        font-size: 12px;
    }

    .time-window-filter {
        padding: 13px;

        border-radius: 18px;
    }

    .time-window-fields {
        grid-template-columns: 1fr;
        gap: 12px;

        margin-bottom: 14px;
    }

    .time-window-field {
        min-height: 0;

        padding: 14px 14px 14px 52px;

        border-radius: 15px;
    }

    .time-window-step {
        top: 14px;
        left: 13px;

        width: 28px;
        height: 28px;
    }

    .time-window-field label {
        font-size: 14px;
    }

    .time-window-preview {
        padding: 14px;

        border-radius: 14px;
    }

    .time-window-preview-title {
        font-size: 12px;
    }

    .time-window-preview p {
        font-size: 14px;
    }

    .time-window-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .time-window-actions button {
        width: 100%;
        min-height: 46px;
    }

    .selected-draws-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .all-predictions-toolbar {
        flex-direction: column;
        align-items: stretch;

        padding: 14px;
    }

    .all-predictions-toolbar #predictionCount {
        width: 100%;
    }

    .all-predictions-toolbar #predictionBtn {
        width: 100%;
        min-height: 46px;
    }

    .strategy-results-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .strategy-result-card {
        min-height: 0;
        padding: 14px;
    }

    .strategy-result-header h3 {
        font-size: 15px;
    }

    .strategy-description {
        margin-bottom: 12px;
    }
}

/* =========================================================
   Very Small Phones
   ========================================================= */

@media (max-width: 420px) {

    .time-window-filter {
        padding: 10px;
    }

    .time-window-field {
        padding: 12px 12px 12px 47px;
    }

    .time-window-step {
        top: 12px;
        left: 11px;

        width: 26px;
        height: 26px;

        font-size: 13px;
    }

    .time-window-preview {
        padding: 12px;
    }

    .strategy-result-card {
        border-radius: 16px;
    }
}

/* =========================================================
   Fixed Backtest Page
   Historical Source Window, Test Settings and Cost Preview
   ========================================================= */

/* =========================================================
   Historical Source Selection
   The three cards allow the user to choose:
   1. Historical date
   2. Starting time
   3. Duration of source draws
   ========================================================= */

.backtest-source-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(230px, 1fr));
    gap: 16px;

    margin-bottom: 18px;
}

/* Date input receives the same full-width behaviour
   as the time-window select fields */
.backtest-date-field input {
    width: 100%;
    min-height: 46px;

    margin-top: 2px;

    color: #0f172a;
    background: #ffffff;

    font-size: 15px;
    font-weight: 700;
}

/* =========================================================
   Backtest Settings Panel
   Contains prediction count, stake and testing duration
   ========================================================= */

.backtest-settings-panel {
    margin-top: 18px;
    padding: 18px;

    background:
        linear-gradient(
            135deg,
            rgba(248, 250, 252, 0.98),
            rgba(239, 246, 255, 0.84)
        );

    border: 1px solid #dbeafe;
    border-radius: 20px;
}

.backtest-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 16px;

    margin-bottom: 18px;
}

.backtest-setting {
    padding: 16px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

/* Use readable Greek sentence labels rather than
   the uppercase style of compact toolbar controls */
.backtest-setting label {
    display: flex;
    flex-direction: column;
    gap: 8px;

    color: #0f172a;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;

    text-transform: none;
    letter-spacing: normal;
}

.backtest-setting input,
.backtest-setting select {
    width: 100%;
    min-height: 46px;

    margin-top: 2px;

    font-size: 15px;
    font-weight: 700;
}

/* =========================================================
   Automatic Backtest Calculation Preview
   Displays test time, number of draws and total cost
   ========================================================= */

.backtest-calculation-preview {
    margin-bottom: 18px;
    padding: 17px 18px;

    background:
        linear-gradient(
            135deg,
            rgba(219, 234, 254, 0.70),
            rgba(239, 246, 255, 0.94)
        );

    border: 1px solid #bfdbfe;
    border-radius: 18px;
}

.backtest-calculation-header {
    margin-bottom: 13px;

    color: #1d4ed8;

    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.backtest-calculation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    gap: 12px;

    margin-bottom: 13px;
}

/* Each calculated value is shown as a compact information box */
.calculation-item {
    display: flex;
    flex-direction: column;
    gap: 7px;

    min-height: 88px;
    padding: 13px 14px;

    color: #0f172a;
    background: rgba(255, 255, 255, 0.80);

    border: 1px solid rgba(191, 219, 254, 0.85);
    border-radius: 14px;
}

.calculation-label {
    color: #64748b;

    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calculation-item strong {
    color: #0f172a;

    font-size: 18px;
    font-weight: 900;
    line-height: 1.3;
}

/* Total cost receives stronger emphasis */
.calculation-cost {
    background:
        linear-gradient(
            135deg,
            rgba(254, 249, 195, 0.86),
            rgba(254, 240, 138, 0.68)
        );

    border-color: #fde047;
}

.calculation-cost strong {
    color: #854d0e;
    font-size: 22px;
}

.backtest-cost-note {
    margin: 0;

    color: #64748b;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

/* Main button for running all fixed strategy tests */
.backtest-run-button {
    min-height: 46px;
    padding: 11px 18px;

    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);

    border-radius: 13px;
}

/* =========================================================
   Backtest Detailed Results
   ========================================================= */

.strategy-distribution {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;

    margin: 14px 0;
    padding: 12px;

    background: #f8fafc;

    border: 1px solid var(--border);
    border-radius: 14px;

    color: #334155;

    font-size: 14px;
}

.strategy-distribution strong {
    margin-right: 5px;
}

.strategy-sample-table {
    margin-top: 12px;
}

/* =========================================================
   Tablet Layout for Fixed Backtest
   ========================================================= */

@media (max-width: 1100px) {

    .backtest-source-fields,
    .backtest-settings-grid {
        grid-template-columns: 1fr;
    }

    .backtest-calculation-grid {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
    }

    .calculation-cost {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   Responsive Tables Without Horizontal Scrolling
   =========================================================
   Apply the class .responsive-data-table to table wrappers.

   On phones:
   - Table headers are hidden.
   - Normal result rows become stacked information cards.
   - Draw-history rows show their 20 numbers in a compact grid.
   ========================================================= */

@media (max-width: 900px) {

    /* Remove desktop scrolling container behaviour on phones */
    .responsive-data-table {
        overflow: visible;
        max-height: none;

        background: transparent;

        border: 0;
        border-radius: 0;
    }

    .responsive-data-table table,
    .responsive-data-table tbody {
        display: block;
        width: 100%;

        white-space: normal;
    }

    /* The data-label on each cell replaces the desktop headers */
    .responsive-data-table thead {
        display: none;
    }

    .responsive-data-table tbody {
        display: grid;
        gap: 12px;
    }

    /* =====================================================
       Generic Result Table Rows
       Used for strategy summaries and sample results
       ===================================================== */

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) {
        display: block;

        padding: 8px 12px;

        background: white;

        border: 1px solid var(--border);
        border-radius: 16px;

        box-shadow: var(--shadow-soft);
    }

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;

        width: 100%;
        padding: 9px 0;

        text-align: right;

        border: 0;
        border-bottom: 1px dashed #e2e8f0;
    }

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) td:last-child {
        border-bottom: 0;
    }

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) td::before {
        content: attr(data-label);

        flex: 0 0 43%;

        color: #64748b;

        font-size: 11px;
        font-weight: 900;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    /* Badges in generic stacked rows align on the right */
    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) td .badge {
        margin-top: 0;
        margin-bottom: 4px;
    }

    /* =====================================================
       Draw History Rows
       Metadata is displayed first, followed by a 5-column
       number grid for the twenty draw numbers.
       ===================================================== */

    .responsive-data-table tbody .draw-row {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 7px;

        padding: 12px;

        background: white;

        border: 1px solid var(--border);
        border-radius: 17px;

        box-shadow: var(--shadow-soft);
    }

    /* Draw metadata occupies full-width lines above numbers */
    .responsive-data-table tbody .draw-row .draw-meta-cell {
        grid-column: 1 / -1;

        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;

        padding: 5px 2px;

        border: 0;

        color: #0f172a;
        text-align: right;
    }

    .responsive-data-table tbody .draw-row .draw-meta-cell::before {
        content: attr(data-label);

        color: #64748b;

        font-size: 11px;
        font-weight: 900;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    /* Individual KINO number inside the mobile draw card */
    .responsive-data-table tbody .draw-row .draw-number-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        min-height: 54px;
        padding: 6px 3px;

        color: #1d4ed8;
        background: #eff6ff;

        border: 1px solid #dbeafe;
        border-radius: 11px;

        font-size: 15px;
        font-weight: 900;
        text-align: center;
    }

    .responsive-data-table tbody .draw-row .draw-number-cell::before {
        content: attr(data-label);

        margin-bottom: 4px;

        color: #94a3b8;

        font-size: 9px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    /* Empty / error table state */
    .responsive-data-table tbody .empty-table-row {
        display: block;

        padding: 15px;

        background: white;

        border: 1px solid var(--border);
        border-radius: 14px;
    }

    .responsive-data-table tbody .empty-table-row td {
        display: block;

        padding: 0;

        border: 0;

        text-align: center;
    }

    /* =====================================================
       Fixed Backtest Mobile Layout
       ===================================================== */

    .backtest-settings-panel {
        padding: 13px;

        border-radius: 18px;
    }

    .backtest-source-fields,
    .backtest-settings-grid,
    .backtest-calculation-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .calculation-cost {
        grid-column: auto;
    }

    .backtest-calculation-preview {
        padding: 14px;

        border-radius: 15px;
    }

    .calculation-item {
        min-height: 0;
        padding: 12px;
    }

    .calculation-item strong {
        font-size: 17px;
    }

    .calculation-cost strong {
        font-size: 21px;
    }

    .backtest-run-button {
        width: 100%;
    }

    .strategy-distribution {
        align-items: flex-start;
    }
}

/* =========================================================
   Very Small Phones
   ========================================================= */

@media (max-width: 420px) {

    .responsive-data-table tbody .draw-row {
        gap: 5px;
        padding: 9px;
    }

    .responsive-data-table tbody .draw-row .draw-number-cell {
        min-height: 48px;

        padding: 5px 2px;

        font-size: 14px;
        border-radius: 9px;
    }

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) {
        padding: 7px 10px;
    }

    .responsive-data-table tbody tr:not(.draw-row):not(.empty-table-row) td {
        gap: 8px;
        padding: 8px 0;
    }

    .calculation-cost strong {
        font-size: 20px;
    }
}
/* =========================================================
   Fixed Backtest - Mobile Visual Fixes
   =========================================================
   1. Prevent predicted-number badges from overflowing cards.
   2. Show source draws as a horizontal mobile carousel.
   ========================================================= */

/* Hidden on desktop. Displayed only when the source-draw
   cards become horizontally scrollable on small screens. */
.mobile-scroll-hint {
    display: none;
}

@media (max-width: 900px) {

    /* =====================================================
       Result Table Badge Overflow Fix
       =====================================================
       Some table cells contain many number badges.
       These cells need to wrap rather than force the page
       wider than the phone screen.
       ===================================================== */

    .responsive-data-table td[data-label="Σταθερή Πρόβλεψη"],
    .responsive-data-table td[data-label="Πρόβλεψη"],
    .responsive-data-table td[data-label="Αποτελέσματα"],
    .responsive-data-table td[data-label="Επιτυχίες"] {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px;

        overflow: hidden;
        word-break: break-word;
        text-align: left !important;
    }

    /* Move the field label above the badges so the badges
       receive the full width of the mobile result card. */
    .responsive-data-table td[data-label="Σταθερή Πρόβλεψη"]::before,
    .responsive-data-table td[data-label="Πρόβλεψη"]::before,
    .responsive-data-table td[data-label="Αποτελέσματα"]::before,
    .responsive-data-table td[data-label="Επιτυχίες"]::before {
        flex: 0 0 100% !important;

        margin-bottom: 4px;

        text-align: left !important;
    }

    /* Tighter number badges inside table cards.
       This helps groups of 10-12 numbers fit naturally. */
    .responsive-data-table td[data-label="Σταθερή Πρόβλεψη"] .badge,
    .responsive-data-table td[data-label="Πρόβλεψη"] .badge,
    .responsive-data-table td[data-label="Αποτελέσματα"] .badge,
    .responsive-data-table td[data-label="Επιτυχίες"] .badge {
        flex: 0 0 auto;

        min-width: 33px;
        margin: 0;
        padding: 8px 9px;

        font-size: 13px;
    }

    /* Ensure long result content can never increase
       the width of the overall page. */
    .responsive-data-table,
    .responsive-data-table table,
    .responsive-data-table tbody,
    .responsive-data-table tr,
    .responsive-data-table td {
        max-width: 100%;
    }

    /* =====================================================
       Source Draws - Horizontal Mobile Carousel
       =====================================================
       Only the draw sample used for prediction becomes
       horizontally scrollable. Backtest result tables remain
       stacked vertically and fully readable.
       ===================================================== */

    .mobile-scroll-hint {
        display: flex;
        align-items: center;
        justify-content: center;

        margin: 4px 0 10px;
        padding: 9px 12px;

        color: #1d4ed8;
        background: #eff6ff;

        border: 1px dashed #93c5fd;
        border-radius: 999px;

        font-size: 12px;
        font-weight: 900;
        text-align: center;
    }

    .source-draws-carousel {
        position: relative;

        overflow-x: auto;
        overflow-y: hidden;

        max-width: 100%;
        padding: 3px 3px 12px;

        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;

        /*
         * A visible horizontal scrollbar helps communicate
         * that additional draw cards exist to the right.
         */
        scrollbar-width: thin;
        scrollbar-color: #93c5fd #e2e8f0;
    }

    .source-draws-carousel::-webkit-scrollbar {
        height: 7px;
    }

    .source-draws-carousel::-webkit-scrollbar-track {
        background: #e2e8f0;
        border-radius: 999px;
    }

    .source-draws-carousel::-webkit-scrollbar-thumb {
        background: #93c5fd;
        border-radius: 999px;
    }

    /*
     * Override the standard mobile table-card layout only
     * for the source-draw carousel.
     */
    .source-draws-carousel table {
        display: block;

        width: max-content;
        min-width: 100%;

        white-space: normal;
    }

    .source-draws-carousel tbody {
        display: flex;
        align-items: stretch;
        gap: 10px;

        width: max-content;
        min-width: 100%;

        padding: 1px;
    }

    /*
     * Each draw becomes a compact horizontal carousel card.
     * The width intentionally allows the next card to peek
     * into view, signalling that the user can swipe.
     */
    .source-draws-carousel tbody .draw-row {
        flex: 0 0 min(76vw, 285px);

        scroll-snap-align: start;

        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;

        padding: 11px;

        background: white;

        border: 1px solid var(--border);
        border-radius: 17px;

        box-shadow: var(--shadow-soft);
    }

    /* Compact draw metadata at the top of each swipeable card */
    .source-draws-carousel tbody .draw-row .draw-meta-cell {
        grid-column: 1 / -1;

        padding: 4px 1px;
    }

    /* Compact number grid inside horizontal draw cards */
    .source-draws-carousel tbody .draw-row .draw-number-cell {
        min-height: 48px;
        padding: 5px 2px;

        font-size: 14px;
    }

    /*
     * Empty states should remain a normal full-width message,
     * not a narrow carousel card.
     */
    .source-draws-carousel tbody .empty-table-row {
        flex: 0 0 calc(100vw - 48px);

        scroll-snap-align: start;
    }
}

@media (max-width: 420px) {

    /* Slightly wider relative cards on very small phones,
       while still allowing part of the next card to be visible. */
    .source-draws-carousel tbody .draw-row {
        flex-basis: 82vw;

        gap: 5px;
        padding: 9px;
    }

    .mobile-scroll-hint {
        font-size: 11px;
        padding: 8px 10px;
    }

    .responsive-data-table td[data-label="Σταθερή Πρόβλεψη"] .badge,
    .responsive-data-table td[data-label="Πρόβλεψη"] .badge,
    .responsive-data-table td[data-label="Αποτελέσματα"] .badge,
    .responsive-data-table td[data-label="Επιτυχίες"] .badge {
        min-width: 31px;
        padding: 7px 8px;
        font-size: 12px;
    }
}
/* =========================================================
   Custom Fixed Backtest - Small Layout Adjustment
   ========================================================= */

.custom-backtest-settings-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
}

.custom-backtest-settings-grid .stake-presets {
    margin-top: 12px;
}

@media (max-width: 900px) {
    .custom-backtest-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Personal Ticket - Mobile Badge Wrapping
   ========================================================= */

@media (max-width: 900px) {

    .responsive-data-table td[data-label="Επιλεγμένοι Αριθμοί"],
    .responsive-data-table td[data-label="Δελτίο"] {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px;

        overflow: hidden;
        text-align: left !important;
    }

    .responsive-data-table td[data-label="Επιλεγμένοι Αριθμοί"]::before,
    .responsive-data-table td[data-label="Δελτίο"]::before {
        flex: 0 0 100% !important;

        margin-bottom: 4px;

        text-align: left !important;
    }

    .responsive-data-table td[data-label="Επιλεγμένοι Αριθμοί"] .badge,
    .responsive-data-table td[data-label="Δελτίο"] .badge {
        flex: 0 0 auto;

        min-width: 33px;
        margin: 0;
        padding: 8px 9px;

        font-size: 13px;
    }
}

@media (max-width: 420px) {

    .responsive-data-table td[data-label="Επιλεγμένοι Αριθμοί"] .badge,
    .responsive-data-table td[data-label="Δελτίο"] .badge {
        min-width: 31px;
        padding: 7px 8px;
        font-size: 12px;
    }
}
/* =========================================================
   Analytics Page - Historical Filters and Strategy Guide
   ========================================================= */

/* Three historical interval selector cards:
   date, starting time and duration. */
.analytics-source-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(230px, 1fr));
    gap: 16px;

    margin-bottom: 18px;
}

/* Additional analytics setting under the source interval. */
.analytics-options-panel {
    max-width: 340px;

    margin-bottom: 16px;
    padding: 15px 16px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.analytics-options-panel label {
    color: #0f172a;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;

    text-transform: none;
    letter-spacing: normal;
}

.analytics-options-panel input {
    width: 100%;
    min-height: 46px;

    margin-top: 2px;

    font-size: 15px;
    font-weight: 700;
}

/* Reset action for the new analytics interval form. */
#resetAnalyticsBtn {
    color: #334155;
    background: white;

    border: 1px solid var(--border);
}

/* =========================================================
   Analytics Result Panels
   ========================================================= */

.analytics-result-panel {
    padding: 16px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f8fafc
        );

    border: 1px solid var(--border);
    border-radius: 18px;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.analytics-result-panel h3 {
    margin-top: 0;
}

.analytics-result-note {
    margin: 0 0 14px;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.5;
}

/* Summary panels for repeats and delayed numbers. */
.analytics-summary-card {
    padding: 17px;

    background: #ffffff;

    border: 1px solid var(--border);
    border-radius: 18px;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.analytics-summary-values {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;

    margin: 14px 0;
}

.analytics-summary-value {
    display: flex;
    flex-direction: column;
    gap: 6px;

    min-width: 200px;
    padding: 12px 14px;

    background: #f8fafc;

    border: 1px solid var(--border);
    border-radius: 14px;
}

.analytics-summary-value span {
    color: #64748b;

    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analytics-summary-value strong {
    color: #0f172a;

    font-size: 19px;
    font-weight: 900;
}

.analytics-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;

    margin-top: 12px;
}

/* Allow pair badges to sit cleanly together. */
.analytics-pair-cell {
    white-space: normal;
}

/* =========================================================
   Strategy Explanation Guide
   ========================================================= */

.strategy-guide-list {
    display: grid;
    gap: 10px;

    margin-top: 18px;
}

.strategy-guide-item {
    overflow: hidden;

    background: #ffffff;

    border: 1px solid var(--border);
    border-radius: 16px;

    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.strategy-guide-item:hover,
.strategy-guide-item[open] {
    border-color: #bfdbfe;

    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
}

.strategy-guide-item summary {
    list-style: none;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 16px 18px;

    cursor: pointer;
    user-select: none;
}

.strategy-guide-item summary::-webkit-details-marker {
    display: none;
}

.strategy-guide-title {
    color: #0f172a;

    font-size: 15px;
    font-weight: 900;
    line-height: 1.35;
}

.strategy-guide-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 28px;
    height: 28px;

    color: #1d4ed8;
    background: #eff6ff;

    border-radius: 999px;

    font-size: 19px;
    font-weight: 900;

    transition: transform 0.18s ease;
}

.strategy-guide-item[open] .strategy-guide-toggle {
    transform: rotate(45deg);
}

.strategy-guide-content {
    padding: 0 18px 17px;

    color: #475569;

    font-size: 14px;
    line-height: 1.6;
}

.strategy-guide-content p {
    margin: 0;
}

/* =========================================================
   Analytics Mobile Layout
   ========================================================= */

@media (max-width: 900px) {

    .analytics-source-fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .analytics-options-panel {
        max-width: none;
    }

    .analytics-result-panel,
    .analytics-summary-card {
        padding: 14px;

        border-radius: 16px;
    }

    .analytics-summary-values {
        display: grid;
        grid-template-columns: 1fr;
    }

    .analytics-summary-value {
        min-width: 0;
    }

    .analytics-badge-row {
        align-items: flex-start;
    }

    /* Pair cells use full width inside the mobile card table. */
    .responsive-data-table td[data-label="Ζεύγος"] {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px;

        text-align: left !important;
    }

    .responsive-data-table td[data-label="Ζεύγος"]::before {
        flex: 0 0 100% !important;

        margin-bottom: 4px;

        text-align: left !important;
    }

    .strategy-guide-item summary {
        padding: 14px;
    }

    .strategy-guide-content {
        padding: 0 14px 14px;
    }
}
/* =========================================================
   Floating Page Help Guide
   =========================================================
   A fixed help button appears at the bottom-left of every page.
   When selected, it opens a page-specific instructions popup.
   ========================================================= */

/* Prevent page scrolling while the popup is open */
body.help-guide-open {
    overflow: hidden;
}

/* =========================================================
   Floating Help Button
   ========================================================= */

.help-guide-trigger {
    position: fixed;
    left: max(20px, env(safe-area-inset-left));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 140;

    display: inline-flex;
    align-items: center;
    gap: 9px;

    min-height: 52px;
    padding: 7px 16px 7px 8px;

    color: white;
    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        );

    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 999px;

    box-shadow:
        0 12px 26px rgba(37, 99, 235, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);

    font-size: 14px;
    font-weight: 900;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.help-guide-trigger:hover {
    transform: translateY(-2px);

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #2563eb
        );

    box-shadow:
        0 16px 30px rgba(37, 99, 235, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Round question-mark icon inside the trigger */
.help-guide-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 37px;
    height: 37px;

    color: #1d4ed8;
    background: white;

    border-radius: 999px;

    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

/* Text next to the floating icon */
.help-guide-trigger-text {
    white-space: nowrap;
}

/* =========================================================
   Popup Overlay
   ========================================================= */

.help-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(15, 23, 42, 0.62);

    backdrop-filter: blur(5px);
}

.help-guide-overlay[hidden] {
    display: none;
}

/* =========================================================
   Popup Dialog
   ========================================================= */

.help-guide-dialog {
    display: flex;
    flex-direction: column;

    width: min(660px, 100%);
    max-height: min(82vh, 820px);

    overflow: hidden;

    color: #0f172a;
    background: white;

    border: 1px solid rgba(226, 232, 240, 0.94);
    border-radius: 24px;

    box-shadow: 0 24px 65px rgba(15, 23, 42, 0.32);

    outline: none;

    animation: help-guide-appear 0.18s ease;
}

@keyframes help-guide-appear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   Popup Header
   ========================================================= */

.help-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;

    padding: 20px 20px 16px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #0f172a
        );
}

.help-guide-label {
    display: inline-flex;

    margin-bottom: 7px;
    padding: 5px 9px;

    color: #1d4ed8;
    background: #dbeafe;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.help-guide-header h2 {
    margin: 0;

    color: white;

    font-size: 23px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

/* Top-right close button */
.help-guide-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;

    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;

    color: white;
    background: rgba(255, 255, 255, 0.12);

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;

    font-size: 29px;
    font-weight: 400;
    line-height: 1;

    box-shadow: none;
}

.help-guide-close:hover {
    background: rgba(255, 255, 255, 0.20);
}

/* =========================================================
   Popup Body
   ========================================================= */

.help-guide-body {
    overflow-y: auto;

    padding: 18px 20px 20px;
}

.help-guide-intro {
    margin: 0 0 20px;

    color: #475569;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.6;
}

.help-guide-body h3 {
    margin: 0 0 13px;

    color: #0f172a;

    font-size: 16px;
    font-weight: 900;
}

/* =========================================================
   Step-by-Step List
   ========================================================= */

.help-guide-steps {
    counter-reset: help-step;

    display: grid;
    gap: 10px;

    margin: 0 0 18px;
    padding: 0;

    list-style: none;
}

.help-guide-steps li {
    counter-increment: help-step;

    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: start;
    gap: 11px;

    padding: 11px 12px;

    background: #f8fafc;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    color: #334155;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.help-guide-steps li::before {
    content: counter(help-step);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    color: white;
    background: linear-gradient(135deg, #2563eb, #3b82f6);

    border-radius: 999px;

    font-size: 13px;
    font-weight: 900;
}

.help-guide-steps li span {
    padding-top: 4px;
}

/* =========================================================
   Useful Note Box
   ========================================================= */

.help-guide-tip {
    padding: 13px 14px;

    color: #713f12;
    background:
        linear-gradient(
            135deg,
            #fef9c3,
            #fef3c7
        );

    border: 1px solid #fde047;
    border-radius: 14px;
}

.help-guide-tip strong {
    display: block;

    margin-bottom: 5px;

    font-size: 13px;
    font-weight: 900;
}

.help-guide-tip p {
    margin: 0;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

/* =========================================================
   Popup Footer
   ========================================================= */

.help-guide-footer {
    display: flex;
    justify-content: flex-end;

    padding: 14px 20px;

    background: #f8fafc;

    border-top: 1px solid var(--border);
}

.help-guide-confirm {
    min-width: 120px;

    color: white;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
}

/* =========================================================
   Phone Layout
   ========================================================= */

@media (max-width: 900px) {

    /*
     * Lift the floating button above the fixed bottom menu.
     * The navigation already occupies the lower phone area.
     */
    .help-guide-trigger {
        left: max(14px, env(safe-area-inset-left));
        bottom: calc(88px + env(safe-area-inset-bottom));

        min-height: 50px;
        padding: 6px;
    }

    /* On phones show the icon only to save screen space */
    .help-guide-trigger-text {
        display: none;
    }

    .help-guide-trigger-icon {
        width: 38px;
        height: 38px;
    }

    /*
     * Display the guide as a bottom sheet on phone screens.
     */
    .help-guide-overlay {
        align-items: flex-end;

        padding: 0;
    }

    .help-guide-dialog {
        width: 100%;
        max-height: min(86vh, 760px);

        border-radius: 24px 24px 0 0;

        animation: help-guide-sheet-appear 0.20s ease;
    }

    @keyframes help-guide-sheet-appear {
        from {
            opacity: 0;
            transform: translateY(24px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .help-guide-header {
        padding: 17px 15px 14px;
    }

    .help-guide-header h2 {
        font-size: 20px;
    }

    .help-guide-close {
        width: 39px;
        height: 39px;
        min-height: 39px;

        font-size: 27px;
    }

    .help-guide-body {
        padding: 15px 14px 17px;
    }

    .help-guide-intro {
        margin-bottom: 16px;

        font-size: 14px;
    }

    .help-guide-steps {
        gap: 8px;
    }

    .help-guide-steps li {
        grid-template-columns: 30px 1fr;
        gap: 9px;

        padding: 9px 10px;

        font-size: 13px;
    }

    .help-guide-steps li::before {
        width: 27px;
        height: 27px;
    }

    .help-guide-steps li span {
        padding-top: 3px;
    }

    .help-guide-footer {
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    }

    .help-guide-confirm {
        width: 100%;
        min-height: 45px;
    }
}

/* =========================================================
   Reduced Motion Accessibility
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .help-guide-trigger,
    .help-guide-dialog {
        transition: none;
        animation: none;
    }
}