:root {
    --bg-color: #0b0709;
    --card-bg: rgba(26, 15, 18, 0.85);
    --primary: #9d0f25;
    --primary-hover: #c9112e;
    --text-main: #e0d0d2;
    --text-muted: #8c7377;
    --border: #4a1019;
    --accent: #d4af37; /* Gold accent */
    --error: #ff3333;
    
    --font-heading: 'Cinzel Decorative', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(rgba(11, 7, 9, 0.7), rgba(11, 7, 9, 0.7)), url('/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.03"/></svg>');
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 700px;
    z-index: 1;
    position: relative;
    transition: max-width 0.5s ease;
}

body:has(#admin-view:not(.hidden)) .container {
    max-width: 1000px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1, h2 {
    font-family: var(--font-heading);
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(157, 15, 37, 0.1);
    backdrop-filter: blur(10px);
}

.admin-card {
    max-width: 100%;
    margin-top: 2rem;
}

.hidden {
    display: none !important;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text-main);
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input[type="text"], input[type="file"] {
    width: 100%;
    background-color: rgba(10, 5, 5, 0.6);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(157, 15, 37, 0.5);
}

.error-msg {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 5px;
}

.hex-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-square {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 2px solid var(--border);
    transition: background-color 0.3s ease;
    background-color: #000;
    flex-shrink: 0;
}

/* Image Preview */
#image-preview-container {
    margin-top: 15px;
    position: relative;
    max-width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: inline-block;
    cursor: crosshair;
}

#image-preview {
    display: block;
    max-width: 100%;
    height: auto;
    pointer-events: none;
}

#center-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    font-size: 1.05rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(157, 15, 37, 0.4);
}

.btn-primary:not(:disabled):hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(157, 15, 37, 0.6);
    transform: translateY(-2px);
}

.btn-twitch {
    background-color: #9146FF;
    color: white;
}

.btn-twitch:hover {
    background-color: #a970ff;
}

.twitch-icon {
    width: 24px;
    height: 24px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: auto;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-outline:hover {
    background: rgba(157, 15, 37, 0.1);
    border-color: var(--primary);
}

#user-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

#username-display {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(74, 16, 25, 0.5);
}

th {
    font-family: var(--font-heading);
    color: var(--accent);
    font-weight: 600;
}

th:last-child, td:last-child {
    text-align: center;
}

tr:hover {
    background-color: rgba(157, 15, 37, 0.05);
}

/* Mascot */
#mascot {
    position: absolute;
    right: -40px; /* Peek out from the right edge */
    bottom: -20px;
    height: 150px;
    max-width: 300px;
    object-fit: contain;
    z-index: 10;
    pointer-events: none;
    opacity: 0.9;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    filter: drop-shadow(-5px 5px 15px rgba(0, 0, 0, 0.7));
}

#mascot.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px) scale(0.8);
}

/* Admin Table Thumbnails */
.thumbnail {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(212, 175, 55, 0.3);
    transition: transform 0.2s, border-color 0.2s;
    display: block;
    margin: 0 auto;
}

.thumbnail:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.modal.hidden {
    display: none !important;
}

.modal:not(.hidden) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content-container {
    width: 80%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 2px solid var(--accent);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
    animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoom {
    from {transform: scale(0.5); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

.modal-close {
    position: absolute;
    top: 30px;
    right: 50px;
    color: #fff;
    font-size: 60px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent);
}

/* Scrollbar styling for table */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

/* Delete Button */
.btn-delete {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(255, 51, 51, 0.1);
    transform: scale(1.1);
}
