/* Modern CSS Reset & Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
    --primary: #5865F2;
    --primary-hover: #4752C4;
    --primary-glow: rgba(88, 101, 242, 0.4);
    --secondary: #66de8b;
    --tertiary: #ffb689;
    --error: #ff4b4b;
    --surface: #111318;
    --surface-dim: #111318;
    --surface-bright: #37393e;
    --surface-container-lowest: #0c0e13;
    --surface-container-low: #191c20;
    --surface-container: #1d2024;
    --surface-container-high: #282a2f;
    --surface-container-highest: #33353a;
    --on-surface: #e2e2e8;
    --on-surface-variant: #c6c5d7;
    --outline: #8f8fa0;
    --outline-variant: #454655;
    --sidebar-bg: #1E1F22;
    --main-bg: #313338;
    --panel-bg: #2B2D31;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #111318;
    color: var(--on-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% { opacity: 0.85; filter: drop-shadow(0 0 15px var(--primary-glow)); }
    50% { opacity: 1; filter: drop-shadow(0 0 25px rgba(88, 101, 242, 0.7)); }
}

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

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

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(69, 70, 85, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(69, 70, 85, 0.8);
}

/* Interactive Elements */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 4px 14px rgba(88, 101, 242, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #6874F5, var(--primary));
    box-shadow: 0 6px 20px rgba(88, 101, 242, 0.4);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
    filter: brightness(0.9);
}

.nav-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item-active {
    background: linear-gradient(90deg, rgba(88,101,242,0.15) 0%, rgba(88,101,242,0) 100%);
    border-left: 3px solid var(--primary);
    color: var(--on-surface) !important;
}

/* Playing Cards Selector */
.playing-card {
    width: 44px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #1E1F22;
    border: 1px solid rgba(69, 70, 85, 0.5);
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    user-select: none;
}

.playing-card:hover:not(.opacity-30) {
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 12px rgba(88,101,242,0.2);
    background-color: rgba(88,101,242,0.05);
}

.playing-card.red { color: var(--error); }
.playing-card.black { color: var(--on-surface); }

.playing-card.selected {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: transparent;
    transform: none !important;
}

/* Table Slots */
.slot-card {
    width: 58px;
    height: 84px;
    border: 2px dashed rgba(69, 70, 85, 0.6);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(30, 31, 34, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .slot-card {
        width: 72px;
        height: 104px;
    }
}

.slot-card:hover {
    border-style: solid;
    border-color: var(--primary);
    background: rgba(88, 101, 242, 0.1);
    box-shadow: 0 0 15px rgba(88, 101, 242, 0.2) inset, 0 0 10px rgba(88, 101, 242, 0.2);
}

/* Table Slot Cards */
.slot-card.filled {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
    background: #fff;
    color: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.slot-card.filled .card-value {
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.slot-card.filled .card-suit {
    font-size: 24px;
    line-height: 1;
}

@media (min-width: 640px) {
    .slot-card.filled .card-value {
        font-size: 20px;
    }
    .slot-card.filled .card-suit {
        font-size: 32px;
    }
}

/* History Table Mini-Cards */
.hist-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
    background-color: #1E1F22;
    border: 1px solid rgba(69, 70, 85, 0.5);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    margin-right: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.hist-card.red { color: #ff4b4b; }
.hist-card.black { color: #e2e2e8; }

/* Peer-checked Toggles */
.peer:checked ~ .bg-secondary {
    background-color: var(--secondary) !important;
}

/* Glassmorphism */
.glass-panel {
    background: rgba(43, 45, 49, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Charts & Progress */
.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 80%;
}

.circle-bg {
    fill: none;
    stroke: rgba(40, 42, 47, 0.5);
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke-width: 3.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
    filter: drop-shadow(0 0 6px rgba(88,101,242,0.6));
}

.win-probability .circle {
    stroke: var(--primary);
}

.percentage {
    fill: #fff;
    font-family: inherit;
    font-size: 0.6em;
    text-anchor: middle;
    font-weight: 700;
}

/* Mini Cards for Analysis */
.mini-card {
    width: 44px;
    height: 64px;
    background: white;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    color: black;
    font-weight: 800;
}

.mini-card .value { font-size: 12px; align-self: flex-start; }
.mini-card .suit { font-size: 20px; }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--panel-bg);
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Utility Classes */
.bg-mesh-pattern {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+CjxjaXJjbGUgY3g9IjIiIGN5PSIyIiByPSIxIiBmaWxsPSJyZ2JhKDI1NSwyNTUsMjU1LDAuMDMpIi8+Cjwvc3ZnPg==');
}
.text-error { color: var(--error) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-primary { color: var(--primary) !important; }
