﻿/* --- Global Resets & Layout --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    padding-top: 70px; /* Clears fixed navbar space */
    padding-bottom: 20px;
    background: #0d0d0d; /* Slightly less dark gray body background */
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: clamp(10px, 1.2vw, 15px);
}

.navbar-custom {
    background-color: #000000 !important; /* Dark gray navbar */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Custom Home & Hero Card Theme Classes --- */
.home-hero-card {
    background-color: #000000; /* Pure black hero card */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(59, 130, 246, 0.15);
    color: #f8fafc;
}

.home-hero-title {
    color: #f8fafc;
    font-weight: 700;
}

.home-hero-text {
    color: #94a3b8;
}

.btn-custom-accent {
    background: aquamarine;
    color: black;
    font-weight: 900;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

    .btn-custom-accent:hover {
        transform: scale(1.04);
        background: #7fffd4;
        color: black;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.5);
    }

/* Page wrapper keeps content centered and full-width */
.page-wrapper {
    min-height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0.5rem;
}

/* --- Game Board Grid Layout --- */
.board-container {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    gap: clamp(2px, 0.3vw, 8px);
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    aspect-ratio: 16 / 10;
    background: #0b0f19;
    padding: clamp(4px, 0.8vw, 16px);
    border-radius: clamp(10px, 1.5vw, 18px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
    container-type: inline-size;
}

.grid-cell {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.block {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: clamp(4px, 0.4vw, 8px);
    display: flex;
    gap: clamp(1px, 0.2vw, 4px);
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 4px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.side-top .block, .side-bottom .block {
    flex-direction: column;
}

.side-left .block, .side-right .block {
    flex-direction: row;
}

.block-corner {
    border-color: #6366f1;
    background: linear-gradient(145deg, #25284e, #0f172a);
}

.block-center-side {
    border-color: #10b981;
    background: linear-gradient(145deg, #133a32, #0f172a);
}

.current-block {
    color: #ffffff !important;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
}

.roll-block:hover {
    transform: scale(1.04);
    z-index: 30;
    border-color: #6366f1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.5);
}

.inner-large {
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(9px, 1.3cqw, 18px);
    color: #38bdf8;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.block-corner .inner-large {
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.3);
}

.block-center-side .inner-large {
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.3);
}

.board-center-area {
    grid-column: 3 / 6;
    grid-row: 4 / 7;
    background: radial-gradient(circle at center, #1e293b 0%, #0b0f19 100%);
    border: 2px dashed #334155;
    border-radius: clamp(8px, 1vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(0.5rem, 1.5vw, 1.5rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

    .board-center-area::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
        pointer-events: none;
    }

/* --- Scalable Roll Button --- */
.roll-button {
    background: aquamarine;
    color: black;
    font-size: clamp(10px, 1.4cqw, 16px);
    font-weight: 900;
    width: clamp(80px, 25cqw, 140px);
    padding: clamp(6px, 0.8cqw, 12px);
    border: 1px solid #334155;
    border-radius: clamp(4px, 0.6vw, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

    .roll-button:hover {
        transform: scale(1.04);
        z-index: 30;
        border-color: #6366f1;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.5);
    }

/* --- Board Editor Row Layout --- */
.edit-block-row {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

    .edit-block-row label {
        font-weight: bold;
        color: #38bdf8;
    }

    .edit-block-row input,
    .edit-block-row textarea {
        background: #1e293b;
        color: white;
        border: 1px solid #475569;
        border-radius: 4px;
        padding: 6px 10px;
        max-width: 100% !important;
        width: 100%;
    }

/* --- Admin Tables & Filters --- */
.usertablerow {
    transition: background-color 0.2s ease;
}

    .usertablerow:hover {
        background-color: rgba(99, 102, 241, 0.15) !important;
        cursor: pointer;
    }

.table-filter-input {
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 100% !important;
    margin-top: 6px;
}

    .table-filter-input::placeholder {
        color: #94a3b8;
    }

    .table-filter-input:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
    }

/* --- Form Controls & Utilities --- */
input, select, textarea {
    max-width: 280px;
}

/* --- Loading Spinner Styles --- */
.spanner {
    position: fixed;
    top: 50%;
    left: 0;
    background: transparent;
    width: 100%;
    display: block;
    text-align: center;
    height: 300px;
    color: #FFF;
    transform: translateY(-50%);
    z-index: 1000;
    visibility: hidden;
}

.overlay {
    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    visibility: hidden;
}

.loader, .loader:before, .loader:after {
    border-radius: 50%;
    width: 2.5em;
    height: 2.5em;
    animation-fill-mode: both;
    animation: load7 1.8s infinite ease-in-out;
}

.loader {
    color: #ffffff;
    font-size: 10px;
    margin: 80px auto;
    position: relative;
    text-indent: -9999em;
    transform: translateZ(0);
    animation-delay: -0.16s;
}

    .loader:before, .loader:after {
        content: '';
        position: absolute;
        top: 0;
    }

    .loader:before {
        left: -3.5em;
        animation-delay: -0.32s;
    }

    .loader:after {
        left: 3.5em;
    }

@@keyframes load7 {
    0%, 80%, 100% {
        box-shadow: 0 2.5em 0 -1.3em;
    }

    40% {
        box-shadow: 0 2.5em 0 0;
    }
}

.show {
    visibility: visible;
}

.spanner, .overlay {
    opacity: 0;
    transition: all 0.3s;
}

    .spanner.show, .overlay.show {
        opacity: 1;
    }

/* --- Media Queries --- */
@media (max-width: 1200px) {
    .board-container {
        max-width: 96vw;
        aspect-ratio: 1.6 / 1;
    }
}

@media (max-width: 980px) {
    .page-wrapper {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .board-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        border-radius: 0;
        aspect-ratio: 1.5 / 1;
        padding: 4px;
    }
}

@media (max-width: 640px) {
    .board-container {
        max-width: 100%;
        aspect-ratio: 1.4 / 1;
        gap: 2px;
        padding: 4px;
        border-radius: 6px;
    }

    .block {
        border-radius: 2px;
        gap: 1px;
    }

    .inner-large {
        font-size: clamp(7px, 2.2cqw, 12px);
    }

    .board-center-area {
        border-width: 1px;
        padding: 0.3rem;
    }
}

@media (max-width: 400px) {
    .board-container {
        aspect-ratio: 1.3 / 1;
    }

    .inner-large {
        font-size: clamp(6px, 1.8cqw, 10px);
    }
}