/* =====================================================
   RPG Wiki - Dark Fantasy Theme
   ===================================================== */

/* ==================== RESET & VARIABLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252538;
    --bg-card: #16213e;
    --accent-primary: #c9a961;
    --accent-secondary: #8b7355;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --border-color: #2a2a3e;
    --danger: #d32f2f;
    --success: #4caf50;
    --warning: #ff9800;
    --gm-secret: #4a1a1a;
    --gm-border: #8b0000;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 2px solid var(--accent-primary);
    padding: 1rem 0;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-primary);
    text-decoration: none;
    text-shadow: 2px 2px 4px var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo::before {
    content: '⚔️';
    font-size: 2rem;
}

/* ==================== NAVIGATION ==================== */
nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

nav a, nav button {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
}

nav a:hover, nav button:hover {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.user-badge {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* ==================== SEARCH BAR ==================== */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

#search-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

#search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 20px var(--shadow);
    display: none;
    z-index: 1000;
}

.search-result-item {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* ==================== MAIN CONTENT ==================== */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-primary);
    text-shadow: 2px 2px 4px var(--shadow);
}

/* ==================== CARDS & ENTITIES ==================== */
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.entity-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.entity-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px var(--shadow);
    border-color: var(--accent-primary);
}

.entity-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.entity-card h3 {
    color: var(--accent-primary);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.entity-type-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.entity-type-badge.lieu { background: #2e7d32; }
.entity-type-badge.pnj { background: #1565c0; }
.entity-type-badge.lore { background: #6a1b9a; }
.entity-type-badge.item { background: #e65100; }
.entity-type-badge.quete { background: #c62828; }

.badge-hidden {
    background: var(--warning);
    color: var(--bg-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.entity-description {
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.5;
}

/* ==================== ENTITY DETAIL VIEW ==================== */
.entity-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1rem;
}

.entity-header {
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.entity-header h1 {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.entity-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1rem;
}

.description-section {
    margin-bottom: 2rem;
}

.description-section h2 {
    color: var(--accent-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.description-content {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Section secrète GM */
.gm-section {
    background: var(--gm-secret);
    border: 2px solid var(--gm-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.gm-section h2 {
    color: var(--danger);
}

.gm-section .description-content {
    background: rgba(139, 0, 0, 0.2);
    border-left-color: var(--gm-border);
}

/* ==================== PLAYER NOTES ==================== */
.player-notes {
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.player-notes h3 {
    color: var(--accent-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-notes h3::before {
    content: '📝';
}

#player-note {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--shadow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #388e3c;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 20px var(--shadow);
}

.login-container h2 {
    color: var(--accent-primary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

/* ==================== NOTIFICATIONS ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow);
    color: white;
    font-weight: 600;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s;
    z-index: 1000;
    max-width: 350px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--success);
}

.notification-error {
    background: var(--danger);
}

.notification-info {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* ==================== FOOTER ==================== */
footer {
    background: var(--bg-secondary);
    border-top: 2px solid var(--accent-primary);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-container {
        max-width: 100%;
    }

    .entity-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 2rem;
    }

    .entity-header h1 {
        font-size: 2rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .entity-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .notification {
        left: 20px;
        right: 20px;
        max-width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .entity-detail {
        padding: 1rem;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none;
}
