/* ============================================
   CyberEdu - Components CSS
   Additional UI Components
   ============================================ */

/* Toast Container */
.toast-container {
    position: fixed;
    top: 90px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 320px;
    max-width: 400px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    pointer-events: auto;
    animation: slideInRight 0.3s ease;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--primary); }

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

/* Accordion */
.accordion {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--border);
}

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

.accordion-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: var(--transition-fast);
}

.accordion-header:hover { background: var(--bg-hover); }

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 20px 16px;
    color: var(--text-secondary);
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    transition: var(--transition-fast);
    z-index: 1000;
    pointer-events: none;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb a:hover { color: var(--primary); }

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Code Block */
.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 16px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.code-copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: var(--transition-fast);
}

.code-copy-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.code-block pre {
    margin: 0;
    padding: 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow-x: auto;
}

.code-block code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
}

/* Tag Input */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-height: 44px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--primary);
}

.tag-remove {
    cursor: pointer;
    opacity: 0.7;
}

.tag-remove:hover { opacity: 1; }

.tag-input input {
    flex: 1;
    min-width: 100px;
    border: none;
    background: none;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    font-size: 14px;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    transition: var(--transition);
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: var(--transition);
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: rgba(0, 229, 255, 0.2);
    border-color: var(--primary);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: var(--primary);
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

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

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

.search-result-type {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(0, 229, 255, 0.1);
    color: var(--primary);
}

/* Difficulty Stars */
.difficulty-stars {
    display: inline-flex;
    gap: 2px;
}

.difficulty-star {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
}

.difficulty-star.active {
    color: var(--danger);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 22, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay.hidden { display: none; }

/* Terminal/Console */
.terminal {
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #00ff00;
    overflow-x: auto;
    line-height: 1.6;
}

.terminal-line {
    display: flex;
    gap: 8px;
}

.terminal-prompt {
    color: var(--primary);
}

.terminal-command {
    color: var(--text-primary);
}

.terminal-output {
    color: var(--text-secondary);
}

/* Leaderboard Table */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-rank {
    width: 60px;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.leaderboard-rank-1 { color: #F59E0B; }
.leaderboard-rank-2 { color: #9CA3AF; }
.leaderboard-rank-3 { color: #CD7F32; }

/* Badge Display */
.badge-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    text-align: center;
}

.badge-display:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.badge-display.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.badge-icon-large {
    font-size: 48px;
    line-height: 1;
}

.badge-rarity-common { box-shadow: 0 0 0 1px var(--border); }
.badge-rarity-uncommon { box-shadow: 0 0 0 1px var(--success); }
.badge-rarity-rare { box-shadow: 0 0 0 1px var(--primary); }
.badge-rarity-epic { box-shadow: 0 0 0 1px var(--purple); }
.badge-rarity-legendary { box-shadow: 0 0 0 1px var(--warning); }
.badge-rarity-mythic { box-shadow: 0 0 0 1px var(--danger); }

/* Responsive Utilities */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
    }
}

/* === NEW FEATURES STYLES === */

/* Threat Map Pulse */
@keyframes threat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.threat-pulse {
    animation: threat-pulse 2s ease infinite;
}

/* Feature Card Grid */
.feature-grid-6 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.feature-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    text-align: center;
}

.feature-tile:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.feature-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.feature-tile-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-tile-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Audio Player */
.podcast-player {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 16px 0;
}

/* Live Badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-full);
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease infinite;
}

/* Score Circle */
.score-circle {
    position: relative;
    display: inline-block;
}

.score-circle svg {
    transform: rotate(-90deg);
}

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