/* Detective de Datos - Styles
   Author: Data Analytics Academy
   Version: 1.0
*/

/* Variables */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body.light-mode {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--success));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--primary);
}

.stat-value {
    font-weight: bold;
    font-size: 1.2rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Mission Cards */
.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.mission-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

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

.mission-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.mission-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
}

.mission-card.completed {
    border-color: var(--success);
}

.mission-number {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.mission-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.mission-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.mission-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.mission-stars {
    color: var(--warning);
}

/* Screen States */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Mission Play */
.mission-play-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-success {
    background: var(--success);
    color: #0f172a;
}

.btn-warning {
    background: var(--warning);
    color: #0f172a;
}

.btn-warning:hover {
    background: #f59e0b;
}

/* Chart */
.chart-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.chart-wrapper {
    position: relative;
    height: 350px;
}

/* Questions */
.question-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.question-progress {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.question-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.options-grid {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    color: var(--text-primary);
}

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

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.option-btn.correct {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.option-btn.incorrect {
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

.number-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.number-input:focus {
    outline: none;
    border-color: var(--primary);
}

.question-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Hints & Explanations */
.hint-panel {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
}

.hint-panel h4 {
    color: var(--warning);
    margin-bottom: 0.5rem;
}

.explanation-panel {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.explanation-panel.correct {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid var(--success);
}

.explanation-panel.incorrect {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--error);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 500px;
    text-align: center;
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-icon.success {
    color: var(--success);
}

.modal-icon.error {
    color: var(--error);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.4s ease;
}

/* Toolbar */
.toolbar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.toolbar-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.toolbar-btn.muted i::before {
    content: "\ebc0";
}

/* Help Modal */
.help-content {
    text-align: left;
    max-width: 450px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.help-content h3 {
    margin: 1rem 0 0.5rem;
    color: var(--primary);
    font-size: 1rem;
}

.help-content h3:first-child {
    margin-top: 0;
}

.help-content ul {
    margin-left: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.help-content li {
    margin-bottom: 0.3rem;
}

.help-content .emoji {
    font-size: 1rem;
    margin-right: 0.3rem;
}

/* Certificate */
.certificate-canvas {
    max-width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.name-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.name-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: center;
}

.name-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.footer-content p {
    margin: 0.5rem 0;
}

.footer-tech {
    font-size: 0.85rem;
    opacity: 0.7;
}

.footer-copy {
    font-size: 0.8rem;
    margin-top: 1rem !important;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .chart-wrapper {
        height: 250px;
    }
}