/**
 * iLottery - Core Modern Dark Theme & Tumbler Styling
 * ROBIS Lab - Laboratory of Robotics, Embedded & Integrated Systems
 * University of Western Macedonia
 */

:root {
    --ilot-bg: #0d1117;
    --ilot-card-bg: #161b22;
    --ilot-card-hover: #1c2128;
    --ilot-border: #30363d;
    --ilot-text-primary: #f0f6fc;
    --ilot-text-secondary: #8b949e;
    --ilot-text-muted: #6e7681;
    --ilot-accent: #00d2d3;
    --ilot-accent-hover: #00adb5;
    --ilot-gold: #f1c40f;
    --ilot-silver: #bdc3c7;
    --ilot-bronze: #e67e22;
    --ilot-success: #238636;
    --ilot-danger: #da3633;
    --ilot-warning: #d29922;
    --ilot-info: #58a6ff;
    --ilot-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --ilot-radius: 12px;
}

body {
    background-color: var(--ilot-bg) !important;
    color: var(--ilot-text-primary) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

main.ilot-container {
    flex: 1 0 auto;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

/* Navbar */
.ilot-navbar {
    background-color: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ilot-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.ilot-brand {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff !important;
    letter-spacing: -0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.ilot-brand .accent {
    color: var(--ilot-accent);
}

.ilot-nav-link {
    color: var(--ilot-text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.ilot-nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.05);
}

.ilot-nav-link.active {
    color: var(--ilot-accent) !important;
    background-color: rgba(0, 210, 211, 0.1);
}

@media (max-width: 575.98px) {
    .ilot-nav-link {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.85rem;
    }
    .ilot-brand {
        font-size: 1.15rem;
    }
    .table-ilot {
        table-layout: fixed;
        width: 100% !important;
    }
}

/* Cards */
.ilot-card {
    background-color: var(--ilot-card-bg);
    border: 1px solid var(--ilot-border);
    border-radius: var(--ilot-radius);
    box-shadow: var(--ilot-shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.ilot-card-hover:hover {
    transform: translateY(-3px);
    border-color: var(--ilot-accent);
}

.ilot-card-header {
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--ilot-border);
    padding: 1rem 1.25rem;
    border-top-left-radius: var(--ilot-radius);
    border-top-right-radius: var(--ilot-radius);
}

/* Badges */
.badge-status {
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-status-active {
    background-color: rgba(35, 134, 54, 0.2);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-status-draft {
    background-color: rgba(139, 148, 158, 0.2);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.3);
}

.badge-status-completed {
    background-color: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.badge-status-cancelled {
    background-color: rgba(218, 54, 51, 0.2);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* Buttons */
.btn-ilot-primary {
    background-color: var(--ilot-accent);
    color: #0b132b;
    border: none;
    font-weight: 700;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-ilot-primary:hover {
    background-color: var(--ilot-accent-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 210, 211, 0.3);
}

.btn-ilot-outline {
    background-color: transparent;
    border: 1px solid var(--ilot-border);
    color: var(--ilot-text-primary);
    font-weight: 600;
    padding: 0.55rem 1.15rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-ilot-outline:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #8b949e;
    color: #ffffff;
}

/* Form inputs */
.form-control, .form-select {
    background-color: #0d1117 !important;
    border: 1px solid var(--ilot-border) !important;
    color: #f0f6fc !important;
    border-radius: 8px !important;
    padding: 0.6rem 0.85rem !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ilot-accent) !important;
    box-shadow: 0 0 0 3px rgba(0, 210, 211, 0.25) !important;
}

.form-label {
    font-weight: 600;
    color: var(--ilot-text-secondary);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

/* Tables */
.table-responsive {
    border: 1px solid var(--ilot-border);
    border-radius: var(--ilot-radius);
    overflow-x: auto;
}

.table-ilot {
    color: var(--ilot-text-primary);
    margin-bottom: 0;
    width: 100%;
}

.table-ilot thead th {
    background-color: #161b22;
    color: var(--ilot-text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ilot-border);
    padding: 0.9rem 1rem;
    white-space: nowrap;
}

.table-ilot tbody td {
    background-color: transparent;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.table-ilot tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   TUMBLER / CAGE ANIMATION STAGE (ΚΛΗΡΩΤΙΔΑ)
   ========================================================================== */

.tumbler-stage {
    position: relative;
    width: 100%;
    min-height: 520px;
    background: radial-gradient(circle at 50% 40%, #1a2332 0%, #0d1117 70%);
    border: 1px solid var(--ilot-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
}

#tumblerCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Tumbler control bar */
.tumbler-controls {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(12px);
    padding: 0.6rem 1.25rem;
    border-radius: 40px;
    border: 1px solid rgba(48, 54, 61, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 95%;
    box-sizing: border-box;
}

@media (max-width: 575.98px) {
    .tumbler-controls {
        width: calc(100% - 1.5rem);
        padding: 0.4rem 0.5rem;
        gap: 0.35rem;
        bottom: 0.5rem;
        justify-content: center;
    }
    .tumbler-controls .btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.78rem;
    }
}

/* Extraction Chute & Ball Animation */
.extracted-ball-spotlight {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 30;
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.extracted-ball-spotlight.show {
    transform: translate(-50%, -50%) scale(1);
}

/* 3D Rendered Lottery Ball */
.lotto-ball {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset -8px -8px 20px rgba(0,0,0,0.5), inset 8px 8px 20px rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lotto-ball .ball-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.lotto-ball .ball-number {
    font-size: 1.6rem;
    font-weight: 900;
    color: #111111;
    line-height: 1;
}

/* Ball colors */
.ball-gold   { background: radial-gradient(circle at 35px 35px, #f9ca24, #d35400); }
.ball-blue   { background: radial-gradient(circle at 35px 35px, #00d2d3, #0984e3); }
.ball-red    { background: radial-gradient(circle at 35px 35px, #ff7675, #d63031); }
.ball-green  { background: radial-gradient(circle at 35px 35px, #55efc4, #00b894); }
.ball-purple { background: radial-gradient(circle at 35px 35px, #a29bfe, #6c5ce7); }

/* Winner Announcement Modal Card */
.winner-popup-card {
    background: #161b22;
    border: 2px solid var(--ilot-gold);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(241, 196, 15, 0.35);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: 1rem;
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 10px 30px rgba(241, 196, 15, 0.2); }
    to { box-shadow: 0 15px 50px rgba(241, 196, 15, 0.5); }
}

/* Confetti Overlay */
#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
}

/* Winner Rack (Extracted balls line up) */
.winner-rack {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    background: rgba(13, 17, 23, 0.7);
    border-radius: 12px;
    border: 1px solid var(--ilot-border);
    margin-top: 1rem;
    align-items: center;
}

.rack-ball-slot {
    flex: 0 0 70px;
    height: 70px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.rack-ball-slot .rack-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    color: #111;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rack-ball-slot .place-badge {
    position: absolute;
    bottom: -6px;
    right: -4px;
    background: #000;
    color: var(--ilot-gold);
    border: 1px solid var(--ilot-gold);
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 10px;
    padding: 0 5px;
}

/* Footer */
.ilot-footer {
    background-color: #0b0e14;
    border-top: 1px solid var(--ilot-border);
    color: var(--ilot-text-muted);
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.85rem;
}
