:root { 
    --primary: #2c3e50; 
    --accent: #e74c3c; 
    --bg: #f4f7f6; 
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', sans-serif; 
    background: var(--bg); 
}

body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

body.app-page {
    display: block;
    padding: 20px;
}

.card { 
    background: white; 
    padding: 2rem; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    width: 300px; 
}

input, select, textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    margin-top: 5px; 
    box-sizing: border-box; 
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

button { 
    width: 100%; 
    padding: 10px; 
    background: #007bff; 
    color: white; 
    border: none; 
    cursor: pointer;
}

button.secondary { 
    background: #6c757d; 
}

.msg { 
    color: red; 
    text-align: center; 
    font-size: 0.9em; 
}

.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    background: white; 
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
}

.tabs { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    border-bottom: 2px solid #eee; 
}

.tab-btn { 
    padding: 12px 20px; 
    border: none; 
    background: none; 
    cursor: pointer; 
    font-weight: bold; 
    color: #7f8c8d; 
}

.tab-btn.active { 
    color: var(--accent); 
    border-bottom: 3px solid var(--accent); 
}

.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
}

.grid-4 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 15px; 
}

/* Layout sections - Général tab */
.info-section {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    background: #fafafa;
}

.info-section h4 {
    display: none;
}

.info-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 600;
}

/* Vitals grid - Point de vie à gauche, aura à droite */
.vitals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.vital-group h5 {
    font-size: 1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.vital-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Attributes grid - Caractéristiques et Arts magiques côte à côte */
.attributes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.attribute-group h5 {
    font-size: 1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.attribute-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.attribute-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: center;
}

.attribute-item label {
    margin-bottom: 0;
    width: 100%;
}

.attribute-item input {
    margin-top: 0;
}

/* Progression grid - XP, PA et Titre horizontalement */
.progression-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.progression-grid > div {
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.btn { 
    padding: 10px 15px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold; 
    color: white; 
    transition: 0.2s; 
}

.btn-save { 
    background: #27ae60; 
    width: 100%;
}

.btn-add { 
    background: var(--primary); 
    margin-top: 10px; 
}

.btn-roll { 
    background: #8e44ad;
    width: 100%;
}

.btn-del { 
    background: var(--accent); 
    padding: 5px 10px; 
}

/* Affichage Technique */
.tech-card { 
    background: #fff; 
    border: 1px solid #e0e0e0; 
    border-left: 5px solid var(--primary); 
    padding: 20px; 
    margin-bottom: 20px; 
    border-radius: 8px; 
}

.tech-card-filou { 
    border-left: 5px solid #8e44ad !important; 
}

.tech-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.tech-header > div:first-child {
    flex: 1;
}

.mana-badge { 
    background: #3498db; 
    color: white; 
    padding: 4px 12px; 
    border-radius: 20px; 
    font-size: 0.9em;
    display: inline-block;
    margin-top: 5px;
}

.mana-cost-display {
    color: #3498db;
    font-weight: bold;
    font-size: 1em;
    padding: 10px;
    border: 1px solid #3498db;
    border-radius: 6px;
    background: #e3f2fd;
    text-align: center;
    margin-top: 5px;
}

.tech-details { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); 
    background: #f9f9f9; 
    padding: 10px; 
    border-radius: 6px; 
    margin: 10px 0; 
    font-size: 0.85em;
    gap: 10px;
}

.tech-desc { 
    font-style: italic; 
    color: #555; 
    margin: 10px 0; 
    border-left: 3px solid #eee; 
    padding-left: 10px; 
    white-space: pre-wrap; 
}

/* Techniques - Ajouter une New Technique box */
.tech-form-container {
    background: #f9f9f9;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.tech-form-container h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.2em;
}

.tech-form-container form {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Notes & Inventaire - Info boxes */
.info-box {
    background: #f9f9f9;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.info-box h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.info-box .split-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 15px;
}

.info-box .split-sections h4 {
    font-size: 1em;
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0;
}

.info-box p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #333;
}

.info-box em {
    display: block;
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Modales */
#diceOverlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.7); 
    display: none; 
    z-index: 100; 
}

#diceResult { 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    text-align: center; 
    display: none; 
    z-index: 101; 
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.dice-val { 
    display: inline-block; 
    width: 35px; 
    height: 35px; 
    line-height: 35px; 
    margin: 5px; 
    border-radius: 50%; 
    border: 2px solid #333; 
    font-weight: bold; 
}

.success { 
    background: #2ecc71; 
    color: white; 
    border-color: #27ae60; 
}

.cancel { 
    background: var(--accent); 
    color: white; 
    border-color: #c0392b; 
}

.critical { 
    background: #f1c40f; 
    color: black; 
    border-color: #f39c12; 
}

#spellOverlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.7); 
    display: none; 
    z-index: 102; 
}

#spellPopup { 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    text-align: center; 
    display: none; 
    z-index: 103; 
    min-width: 350px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .tabs {
        margin-bottom: 15px;
    }

    .tab-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }

    .vitals-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .attributes-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .progression-grid {
        grid-template-columns: 1fr;
    }

    .attribute-item {
        grid-template-columns: 1fr;
    }

    .split-sections {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tech-header {
        flex-direction: column;
    }

    #diceResult,
    #spellPopup {
        min-width: 90%;
        max-width: 90%;
        padding: 20px;
    }
}