/* Magic Box Specific Styles */

/* --- MAGIC BOX STYLES --- */

/* Container */
.magic-mode-container {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 0;
    transition: all 0.5s ease;
}

.magic-mode-container.hidden {
    display: none;
    opacity: 0;
}

.magic-intro h1 {
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.magic-intro p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 50px;
}

/* Seletor de Arquivos (Box) */
.magic-box-wrapper {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto;
    perspective: 1000px;
}

.the-box {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s;
    cursor: pointer;
}

.box-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-widget) 0%, #2a2a30 100%);
    border: 2px solid var(--accent-orange);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(249, 87, 56, 0.15);
    position: relative;
    z-index: 10;
}

.pulse-icon {
    font-size: 5rem;
    color: var(--accent-orange);
    animation: pulse 2s infinite;
}

.draw-btn {
    margin-top: 50px;
    background: var(--accent-orange);
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(249, 87, 56, 0.3);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.draw-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(249, 87, 56, 0.4);
    background: #e04b2f;
}

.draw-btn:active {
    transform: translateY(1px);
}

.loading-msg {
    margin-top: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    font-family: 'Courier New', monospace;
}

.loading-msg.visible {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shaking {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

/* --- Lista de Casos Manual --- */
.toggle-list-btn {
    position: absolute;
    top: 40px;
    right: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100;
}

.toggle-list-btn:hover {
    background: var(--bg-widget);
    color: white;
}

.manual-mode-container {
    position: fixed;
    top: 0;
    right: -100%;
    width: 400px;
    height: 100vh;
    background-color: var(--bg-dark);
    border-left: 1px solid var(--border-color);
    padding: 30px;
    z-index: 1100;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
}

.manual-mode-container.open {
    right: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.close-list-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.case-card {
    background: var(--bg-widget);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.case-card:hover {
    border-color: var(--accent-orange);
    transform: translateX(-5px);
}

.case-card h4 {
    color: white;
    margin-bottom: 5px;
}

.case-card .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

/* --- Área do Caso (Workspace) --- */
.case-workspace {
    display: none;
    animation: fadeIn 0.5s;
}

.case-workspace.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-secondary:hover {
    color: white;
    border-color: white;
}

.case-content-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
}

.case-paper {
    background-color: #fdfbf7;
    
    /* MORE COMPLEX & VISIBLE TEXTURE:
       1. Stronger SVG Noise
       2. Conic gradient for random surface unevenness
       3. Stronger folds (Linear/Radial)
       4. Visible fiber grain
    */
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E"),
        conic-gradient(from 45deg at 50% 50%, rgba(0,0,0,0.02) 0deg, transparent 60deg, rgba(0,0,0,0.02) 120deg, transparent 180deg),
        linear-gradient(175deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.08) 40%, rgba(0,0,0,0.08) 60%, rgba(0,0,0,0) 100%),
        radial-gradient(circle at 15% 25%, rgba(0,0,0,0.08) 0%, transparent 20%),
        radial-gradient(circle at 85% 75%, rgba(0,0,0,0.08) 0%, transparent 20%),
        repeating-linear-gradient(45deg, rgba(160, 82, 45, 0.04) 0, rgba(160, 82, 45, 0.04) 1px, transparent 1px, transparent 4px);
        
    background-size: 150px 150px, 100% 100%, 100% 100%, 60% 60%, 60% 60%, 8px 8px;
    background-blend-mode: multiply;
    
    color: #1a1a1f;
    padding: 30px 60px;
    border-radius: 2px;
    
    /* Stronger Vignette & Shadow */
    box-shadow: 
        0 2px 10px rgba(0,0,0,0.2),
        inset 0 0 60px rgba(101, 67, 33, 0.1);
        
    font-family: 'Courier New', Courier, monospace;
    min-height: 450px;
    position: relative;
    border-left: none;
    border-top: none;
}

.case-paper::before {
    content: "TOP SECRET";
    position: absolute;
    top: 30px;
    right: 30px;
    border: 4px solid #d63031;
    color: #d63031; /* Red stamp color */
    padding: 10px 20px;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 2px;
    opacity: 0.6; /* Fixed Opacity */
    transform: rotate(10deg);
    font-family: 'Impact', sans-serif;
    mix-blend-mode: multiply; /* Better stamp blending */
    
    /* Grunge Mask */
    mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxmaWx0ZXIgaWQ9Im4iPjxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjUiIHN0aXRjaFRpbGVzPSJzdGl0Y2giLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ0cmFuc3BhcmVudCIvPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiMwMDAiIG9wYWNpdHk9IjAuNSIgZmlsdGVyPSJ1cmwoI24pIi8+PC9zdmc+');
    -webkit-mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxmaWx0ZXIgaWQ9Im4iPjxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjUiIHN0aXRjaFRpbGVzPSJzdGl0Y2giLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ0cmFuc3BhcmVudCIvPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiMwMDAiIG9wYWNpdHk9IjAuNSIgZmlsdGVyPSJ1cmwoI24pIi8+PC9zdmc+');
}

.case-paper h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #555;
    padding-bottom: 10px;
    color: #111;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

.case-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
    letter-spacing: 0.5px;
}

.badge.difficulty { background-color: #444; }
.badge.region { background-color: #666; }
.badge.type { background-color: var(--accent-orange); }

.case-paper h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #222;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-left: 3px solid #333; /* Darker border for contrast */
    padding-left: 10px;
}

.case-paper ul {
    padding-left: 20px;
}

.case-paper li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.confidential-section {
    margin-top: 40px;
    background-color: transparent;
    border: 2px dashed #555; /* Stamped look */
    padding: 20px;
    border-radius: 2px;
}

.confidential-section h3 {
    border-left: none;
    padding-left: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Caderno e Área de Resposta --- */
.detective-notebook-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detective-notebook {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--accent-orange);
    cursor: pointer;
    font-size: 1.2rem;
}

.notebook-paper {
    background-color: #fff9c4;
    flex-grow: 1;
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    border-top: 20px solid #eee;
}

/* Notebook Alignment Fix */
.notebook-paper textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    resize: none;
    padding: 0 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px; 
    line-height: 30px;
    color: #333;
    outline: none;
    background-image: linear-gradient(#999 1px, transparent 1px);
    background-size: 100% 30px;
    background-attachment: local;
    padding-top: 0px; 
    margin-top: 29px;
}

.notebook-footer {
    margin-top: 5px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Answer Section */
.answer-section {
    background-color: var(--bg-widget);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.answer-section h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.answer-section textarea {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 4px;
    min-height: 80px;
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
}

.verification-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-verify {
    background-color: var(--accent-orange);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-verify:hover {
    background-color: #e04b2f;
}

.btn-reveal {
    background: transparent;
    border: 1px solid #444;
    color: #666;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-reveal:hover {
    border-color: #666;
    color: #888;
}

.feedback-msg {
    margin-top: 10px;
    font-size: 0.9rem;
    display: none;
    padding: 10px;
    border-radius: 4px;
}

.feedback-msg.success { background-color: rgba(46, 204, 113, 0.2); color: #2ecc71; display: block; }
.feedback-msg.error { background-color: rgba(231, 76, 60, 0.2); color: #e74c3c; display: block; }

.solution-box {
    margin-top: 15px;
    padding: 15px;
    background-color: #2c2c35;
    border-left: 3px solid var(--accent-orange);
    color: #fff;
    display: none;
}

.solution-box.visible {
    display: block;
    animation: fadeIn 0.5s;
}

@media (max-width: 900px) {
    .case-content-grid {
        grid-template-columns: 1fr;
    }
    .manual-mode-container {
        width: 300px;
    }
}
