/**
 * Protocoles - Fiches Techniques Médicales
 * Styles
 */

:root {
    --primary: #00897b;
    --primary-hover: #00695c;
    --primary-light: #e0f2f1;

    --success: #4caf50;
    --success-light: #e8f5e9;
    --warning: #ff9800;
    --warning-light: #fff3e0;
    --danger: #f44336;
    --danger-light: #ffebee;
    --info: #2196f3;
    --info-light: #e3f2fd;

    --text: #333;
    --text-muted: #666;
    --bg: #f5f5f5;
    --bg-card: #fff;
    --border: #e0e0e0;

    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    margin: 0 0 0.5rem;
    background: var(--warning-light);
    color: #795600;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.4;
}

.preview-banner i {
    color: var(--warning);
    font-size: 1rem;
    flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e0;
        --text-muted: #aaa;
        --bg: #121212;
        --bg-card: #1e1e1e;
        --border: #333;
        --primary-light: #1a3a37;
        --success-light: #1a331a;
        --warning-light: #332a1a;
        --danger-light: #331a1a;
        --info-light: #1a2a33;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: inherit;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.15);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-actions-inline {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: inherit;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(0,0,0,0.1);
}

.btn-icon.active {
    color: var(--warning);
}

/* Main */
.app-main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Search */
.search-section {
    margin-bottom: 1rem;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Mode tabs */
.modes-section {
    margin-bottom: 1.5rem;
}

.modes-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem;
}

.mode-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8125rem;
}

.mode-tab i {
    font-size: 1.25rem;
}

.mode-tab:hover {
    background: var(--bg);
}

.mode-tab.active {
    background: var(--primary);
    color: white;
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Section headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.125rem;
    flex: 1;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Items list */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    font-size: 1rem;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.item-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-arrow {
    color: var(--text-muted);
}

/* Fiche view */
.fiche-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.fiche-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.fiche-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.fiche-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.375rem;
}

.fiche-description {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Fiche content sections */
.fiche-content {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.fiche-section {
    margin-bottom: 1.5rem;
}

.fiche-section:last-child {
    margin-bottom: 0;
}

.fiche-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--primary);
}

.fiche-section ul,
.fiche-section ol {
    margin: 0;
    padding-left: 1.25rem;
}

.fiche-section li {
    margin-bottom: 0.5rem;
}

.fiche-section li:last-child {
    margin-bottom: 0;
}

.fiche-section p {
    margin: 0 0 0.75rem 0;
}

.fiche-section p:last-child {
    margin-bottom: 0;
}

/* Alert boxes in fiches */
.alert-box {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-box:last-child {
    margin-bottom: 0;
}

.alert-box.warning {
    background: var(--warning-light);
    border-left: 4px solid var(--warning);
}

.alert-box.danger {
    background: var(--danger-light);
    border-left: 4px solid var(--danger);
}

.alert-box.info {
    background: var(--info-light);
    border-left: 4px solid var(--info);
}

.alert-box.success {
    background: var(--success-light);
    border-left: 4px solid var(--success);
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Checklist view */
.checklist-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.checklist-header {
    margin-bottom: 1.5rem;
}

.checklist-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.checklist-description {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.checklist-progress {
    font-weight: 600;
    color: var(--primary);
}

.checklist-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-phase {
    margin-bottom: 1rem;
}

.checklist-phase:last-child {
    margin-bottom: 0;
}

.phase-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.phase-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.checklist-item:hover {
    background: var(--primary-light);
}

.checklist-item.checked {
    background: var(--success-light);
    border-color: var(--success);
}

.checklist-item.checked .check-icon {
    background: var(--success);
    color: white;
}

.check-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
    color: transparent;
    transition: all 0.2s;
}

.checklist-item.checked .check-icon::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: white;
}

.check-text {
    flex: 1;
    font-size: 0.9375rem;
}

.checklist-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.checklist-actions button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checklist-actions .secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Quiz view */
.quiz-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.quiz-header {
    margin-bottom: 1.5rem;
}

.quiz-header h2 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
}

.quiz-progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.quiz-progress-bar .progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.quiz-question {
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:hover:not(.disabled) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-light);
}

.quiz-option.incorrect {
    border-color: var(--danger);
    background: var(--danger-light);
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-letter {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--text);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.quiz-option.selected .option-letter,
.quiz-option.correct .option-letter {
    background: var(--primary);
    color: white;
}

.quiz-option.correct .option-letter {
    background: var(--success);
}

.quiz-option.incorrect .option-letter {
    background: var(--danger);
}

.option-text {
    flex: 1;
    font-size: 0.9375rem;
}

/* Quiz feedback */
.quiz-feedback {
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: center;
}

.quiz-feedback.correct {
    background: var(--success-light);
}

.quiz-feedback.incorrect {
    background: var(--danger-light);
}

.feedback-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.quiz-feedback.correct .feedback-icon::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--success);
}

.quiz-feedback.incorrect .feedback-icon::before {
    content: "\f00d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--danger);
}

.feedback-text {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-explanation {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.quiz-actions {
    display: flex;
    justify-content: center;
}

.quiz-actions button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quiz-actions .primary {
    background: var(--primary);
    color: white;
}

.quiz-actions .primary:hover {
    background: var(--primary-hover);
}

/* Quiz results */
.quiz-results {
    text-align: center;
}

.results-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.results-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.results-message {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.results-details {
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.results-actions button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-actions .primary {
    background: var(--primary);
    color: white;
}

.results-actions .secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Sources */
.sources-details {
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.sources-details summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sources-details summary:hover {
    background: var(--bg);
}

.sources-content {
    padding: 1rem;
    padding-top: 0;
    font-size: 0.875rem;
}

.source-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.source-item:last-child {
    margin-bottom: 0;
}

.source-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.source-citation {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.source-link:hover {
    text-decoration: underline;
}

/* Empty message */
.empty-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Print styles */
@media print {
    .app-header,
    .search-section,
    .modes-section,
    .btn-link,
    .btn-icon,
    .checklist-actions,
    .quiz-actions,
    .results-actions {
        display: none !important;
    }

    .fiche-card,
    .checklist-card {
        border: none;
        box-shadow: none;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .results-actions {
        flex-direction: column;
    }
}
