/**
 * Diplomacy Mastery - Frontend CSS v2.0
 * Clean white/light theme
 */

/* General */
.dm-frontend-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
}
.dm-frontend-wrap h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 10px;
}
.dm-frontend-wrap h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 15px;
}

/* Notices */
.dm-notice {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
}
.dm-notice-warning {
    background: #fff8e5;
    border-left-color: #dba617;
}
.dm-notice-error {
    background: #fcf0f0;
    border-left-color: #d63638;
}

/* Buttons */
.dm-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}
.dm-btn-primary {
    background: #2271b1;
    color: #fff;
}
.dm-btn-primary:hover {
    background: #135e96;
    color: #fff;
}
.dm-btn-secondary {
    background: #e0e0e0;
    color: #333;
}
.dm-btn-outline {
    background: transparent;
    border: 2px solid #2271b1;
    color: #2271b1;
}
.dm-btn-outline:hover {
    background: #2271b1;
    color: #fff;
}

/* Domain Grid */
.dm-domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.dm-domain-card {
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    padding: 18px 14px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    cursor: pointer;
}
.dm-domain-card:hover {
    border-color: #2271b1;
    box-shadow: 0 3px 10px rgba(34,113,177,0.12);
    transform: translateY(-2px);
}
.dm-domain-card.active {
    border-color: #2271b1;
    background: #f0f6fc;
}
.dm-domain-icon {
    display: block;
    font-size: 32px;
    margin-bottom: 6px;
}
.dm-domain-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
}
.dm-domain-count {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 3px;
}

/* Filter Bar */
.dm-filter-bar {
    display: flex;
    gap: 8px;
    margin: 12px 0 20px;
    flex-wrap: wrap;
}
.dm-filter-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    text-decoration: none;
    color: #555;
    transition: all 0.2s;
}
.dm-filter-btn.active, .dm-filter-btn:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* Scenario Cards */
.dm-scenario-list {
    display: grid;
    gap: 15px;
}
.dm-scenario-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.dm-scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.dm-scenario-header h4 {
    margin: 0;
    font-size: 16px;
    color: #1d2327;
}
.dm-scenario-preview {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}
.dm-scenario-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.dm-format-tag {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.dm-domain-tag {
    background: #f3e5f5;
    color: #6a1b9a;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}
.dm-attempted {
    font-size: 12px;
    color: #0a6b2e;
}

/* Difficulty badges */
.dm-difficulty-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.dm-diff-beginner { background: #e8f5e9; color: #2e7d32; }
.dm-diff-intermediate { background: #fff3e0; color: #e65100; }
.dm-diff-advanced { background: #fce4ec; color: #c62828; }
.dm-diff-expert { background: #f3e5f5; color: #6a1b9a; }

/* Modal */
.dm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dm-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.dm-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    cursor: pointer;
    color: #888;
    line-height: 1;
}
.dm-modal-close:hover {
    color: #333;
}

/* Scenario display */
.dm-scenario-display {
    margin-bottom: 20px;
}
.dm-scenario-badge-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.dm-scenario-text {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px;
    line-height: 1.7;
    font-size: 15px;
    white-space: pre-wrap;
}

/* Response area */
.dm-format-hint {
    background: #f0f6fc;
    border-left: 3px solid #2271b1;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    border-radius: 0 4px 4px 0;
}
#dm-user-response {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}
#dm-user-response:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.15);
}
.dm-submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}
#dm-timer {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* Loading */
.dm-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: dm-spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes dm-spin {
    to { transform: rotate(360deg); }
}
#dm-loading {
    text-align: center;
    padding: 30px;
}
#dm-loading p {
    font-size: 16px;
    color: #666;
}

/* Evaluation Results */
.dm-eval-wrap {
    padding: 10px 0;
}
.dm-eval-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}
.dm-score-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dm-score-num {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}
.dm-score-high { background: linear-gradient(135deg, #2e7d32, #43a047); }
.dm-score-mid { background: linear-gradient(135deg, #e65100, #fb8c00); }
.dm-score-low { background: linear-gradient(135deg, #c62828, #e53935); }
.dm-score-info h3 {
    margin: 0 0 5px;
    font-size: 22px;
}

/* Dimension bars */
.dm-dimensions {
    margin-bottom: 20px;
}
.dm-dimensions h4 {
    margin-bottom: 12px;
}
.dm-dim-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.dm-dim-label {
    width: 160px;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}
.dm-dim-bar-wrap {
    flex-grow: 1;
    height: 16px;
    background: #eee;
    border-radius: 8px;
    overflow: hidden;
}
.dm-dim-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s;
}
.dm-dim-score {
    width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Eval sections */
.dm-eval-section {
    margin-bottom: 18px;
}
.dm-eval-section h4 {
    margin-bottom: 8px;
    font-size: 15px;
}
.dm-eval-section ul {
    margin: 0;
    padding-left: 20px;
}
.dm-eval-section li {
    margin-bottom: 4px;
    font-size: 14px;
}
.dm-eval-section p {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}
.dm-expert-tip {
    background: #fff8e5;
    border: 1px solid #f0d36e;
    border-radius: 8px;
    padding: 14px;
    margin: 15px 0;
    font-size: 14px;
}
.dm-peer-compare {
    background: #f0f6fc;
    border: 1px solid #c3d5e4;
    border-radius: 8px;
    padding: 14px;
    margin: 15px 0;
}
.dm-peer-compare h4 {
    margin: 0 0 8px;
}
.dm-eval-actions {
    text-align: center;
    margin-top: 20px;
}

/* Course Grid */
.dm-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}
.dm-course-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.dm-course-card.dm-enrolled {
    border-left: 4px solid #2271b1;
}
.dm-course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.dm-course-header h4 {
    margin: 0;
    font-size: 17px;
}
.dm-course-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
    margin: 10px 0;
}

/* Progress bar */
.dm-progress-bar-wrap {
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0 4px;
}
.dm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2271b1, #43a047);
    border-radius: 5px;
    transition: width 0.5s;
}
.dm-progress-text {
    font-size: 13px;
    color: #666;
}
.dm-enrollment-status {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.dm-status-enrolled { color: #2271b1; }
.dm-status-in_progress { color: #e65100; }
.dm-status-completed { color: #2e7d32; }
.dm-status-dropped { color: #888; }
.dm-completed-badge {
    color: #2e7d32;
    font-weight: 600;
}

/* Stats row */
.dm-stats-row {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.dm-stat-mini {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px 25px;
    text-align: center;
    min-width: 140px;
}
.dm-stat-mini strong {
    display: block;
    font-size: 28px;
    color: #2271b1;
}

/* Domain progress cards */
.dm-domain-progress {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.dm-domain-progress-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
}
.dm-domain-progress-card h4 {
    margin: 0 0 8px;
    font-size: 15px;
}
.dm-domain-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* Tables */
.dm-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dm-table thead {
    background: #f8f9fa;
}
.dm-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}
.dm-table td {
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.dm-table tr:hover {
    background: #f8f9fa;
}
.dm-leaderboard-table .dm-top-3 {
    background: #fffde7;
}
.dm-rank {
    font-size: 18px;
    text-align: center;
}

/* Knowledge Base */
.dm-kb-category {
    margin-bottom: 25px;
}
.dm-kb-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}
.dm-kb-card h4 {
    margin: 0 0 8px;
    color: #2271b1;
}
.dm-kb-card p {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.5;
}
.dm-kb-examples {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}
.dm-kb-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
}

/* Certificate - Dynamic styles via CSS custom properties */
.dm-certificate {
    --cert-primary: #1a5276;
    --cert-accent: #d4af37;
    background: #fff;
    border-radius: 12px;
    padding: 50px 40px;
    text-align: center;
    max-width: 700px;
    margin: 20px auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.dm-cert-style-classic { border: 3px solid var(--cert-primary); }
.dm-cert-style-modern { border: 1px solid #e0e0e0; border-top: 5px solid var(--cert-primary); }
.dm-cert-style-elegant { border: 4px double var(--cert-primary); box-shadow: inset 0 0 0 2px var(--cert-accent), 0 4px 20px rgba(0,0,0,0.08); }
.dm-cert-logo { max-height: 60px; margin-bottom: 10px; }
.dm-cert-org { font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: var(--cert-primary); margin-bottom: 5px; }
.dm-cert-header h1 { font-size: 28px; color: var(--cert-primary); margin: 5px 0; }
.dm-cert-header h2 { font-size: 16px; color: var(--cert-accent); font-weight: 400; }
.dm-cert-divider { width: 80px; height: 2px; background: var(--cert-accent); margin: 20px auto; }
.dm-cert-awarded { font-size: 14px; color: #888; margin-top: 15px; }
.dm-cert-name { font-size: 32px; color: var(--cert-primary); margin: 10px 0; }
.dm-cert-text { font-size: 14px; color: #555; line-height: 1.7; max-width: 500px; margin: 10px auto; }
.dm-cert-details { display: flex; justify-content: center; gap: 30px; margin: 20px 0; font-size: 14px; color: #555; }
.dm-cert-signatory { margin-top: 30px; }
.dm-cert-sig-line { width: 200px; height: 1px; background: #ccc; margin: 0 auto 8px; }
.dm-cert-sig-name { font-size: 14px; font-weight: 600; color: #333; }
.dm-cert-sig-title { font-size: 12px; color: #888; }
.dm-cert-footer { margin-top: 25px; padding-top: 20px; border-top: 1px solid #eee; }
.dm-cert-footer-text { font-size: 12px; color: #aaa; margin-bottom: 12px; }
.dm-no-print { }
@media print { .dm-no-print { display: none !important; } }

/* Error message */
.dm-error-msg {
    background: #fcf0f0;
    border: 1px solid #f5c6cb;
    padding: 14px 18px;
    border-radius: 6px;
    color: #721c24;
}

/* No data */
.dm-no-data {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 15px;
}

/* Print styles */
@media print {
    .dm-frontend-wrap { max-width: 100%; }
    .dm-btn, .dm-modal, .dm-filter-bar { display: none !important; }
    .dm-certificate { border-width: 2px; box-shadow: none; }
}

/* Responsive */
@media (max-width: 768px) {
    .dm-domain-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .dm-course-grid { grid-template-columns: 1fr; }
    .dm-eval-header { flex-direction: column; text-align: center; }
    .dm-dim-label { width: 100px; }
    .dm-modal-content { width: 95%; padding: 20px; }
    .dm-cert-details { flex-direction: column; gap: 8px; }
}
