/* Premium DnD Theme */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@300;400;700&display=swap');

:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --primary: #d4af37;
    /* Gold */
    --accent: #7209b7;
    /* Deep Purple */
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --danger: #cf6679;
    --success: #03dac6;
    --border-radius: 8px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Lato', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: 'Cinzel', serif;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.card {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    font-family: 'Cinzel', serif;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #e5c158;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* Inputs & UI Elements */
input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.8rem;
    border: 1px solid #444;
    border-radius: var(--border-radius);
    background: #111;
    color: var(--text-main);
    width: 100%;
    margin-bottom: 1rem;
    /* Instant transition as requested */
    transition: none;
}

/* Focus Animation */
@keyframes flash-border {
    0% {
        border-color: var(--primary);
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
    }

    100% {
        border-color: #444;
        box-shadow: none;
    }
}

input:focus,
textarea:focus {
    outline: none;
    /* Flash once, then revert */
    animation: flash-border 0.5s ease-out;
}

/* Specific Button Styles to avoid lingering focus */
.btn,
.btn-secondary {
    /* Transitions for transform/shadow only, not border/color */
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:focus,
.btn-secondary:focus {
    outline: none;
    /* No border change on generic focus (mouse click) */
}

.btn:active,
.btn-secondary:active {
    transform: translateY(2px);
}

/* Optional: Focus Visible for accessibility (keyboard nav) */
.btn:focus-visible,
.btn-secondary:focus-visible {
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Calendar Grid */
.calendar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Smaller min-width */
    gap: 0.5rem;
    /* Reduced gap */
    margin-top: 2rem;
}

.calendar-day {
    background: rgba(0, 0, 0, 0.3);
    min-height: 60px;
    /* Smaller height */
    padding: 2px;
    /* Reduced parsing */
    border: 1px solid #333;
    position: relative;
    cursor: pointer;
    font-size: 0.9rem;
    /* Smaller font */
}

.calendar-day:hover {
    background: #303030;
}

.calendar-header {
    text-align: center;
    font-weight: bold;
    color: var(--text-muted);
    padding: 10px;
}

.event-marker {
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 4px;
    margin-top: 2px;
    border-radius: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Inventory List */
.inventory-list {
    list-style: none;
    padding: 0;
}

.inventory-item {
    background: #2a2a2a;
    margin-bottom: 10px;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-item strong {
    color: var(--primary);
    display: block;
}

/* GM Inventory Sidebar Layout */
.inventory-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    min-height: 500px;
}

.player-sidebar {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-select-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    text-align: left;
    padding: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.2s;
}

.player-select-btn:hover {
    background: #252525;
    color: var(--text-main);
}

.player-select-btn.active {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: bold;
}

.inventory-view {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 2rem;
}

/* Player Management Tab */
.player-mgmt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.player-card {
    background: #252525;
    border: 1px solid #333;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.player-card.blocked {
    opacity: 0.6;
    border-color: var(--danger);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-left: 0.5rem;
}

.status-badge.active {
    background: #1b5e20;
    color: #a5d6a7;
}

.status-badge.blocked {
    background: #b71c1c;
    color: #ffcdd2;
}

.status-badge.pending {
    background: #f57f17;
    color: #fff9c4;
}

.access-code {
    font-family: monospace;
    background: #111;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--primary);
    letter-spacing: 1px;
}

.blurred-code {
    filter: blur(5px);
    transition: filter 0.3s ease;
    user-select: none;
    cursor: pointer;
}

.blurred-code:hover {
    filter: none;
    user-select: all;
}

/* Specific Page Styles */
.login-split {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.login-box {
    flex: 1;
    min-width: 300px;
}

.notification {
    background: var(--accent);
    color: white;
    padding: 1rem;
    text-align: center;
    display: none;
    /* Toggled by JS */
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-panel);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
}

/* Inventory Card Styles - Added to prevent jumping and unify design */
.inventory-card {
    position: relative;
    padding: 1.25rem;
    background: linear-gradient(135deg, #1e1e1e 0%, #252525 100%);
    border: 1px solid #333;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 0;
    /* Grid handles gap */
    color: var(--text-main);
}

.inventory-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    /* translateY removed to prevent jumping on re-render */
}

.inventory-card .icon {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.inventory-card h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inventory-card .badge {
    background: var(--primary);
    color: #000;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: bold;
    flex-shrink: 0;
}

.inventory-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inventory-card .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}