/* ===================================================================== */
/*                    📊 CALCULADORA DE MATRIZES                        */
/* ===================================================================== */

/* ===================================
   VARIÁVEIS DE COR - ÁREA MATEMÁTICA
   ================================== */
:root {
    --primary: #667eea;        /* Azul lógico */
    --secondary: #764ba2;      /* Roxo precisão */
    --accent: #f093fb;         /* Rosa suave */
    --light: #f8f9ff;          /* Fundo azul claro */
    --gradient: linear-gradient(135deg, #667eea, #764ba2);
    --dark-primary: #4c63d2;   /* Azul mais escuro */
    --light-accent: #fce4ec;   /* Rosa claro */
}

/* ===================================
   PREVENIR SCROLL HORIZONTAL
   ================================== */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

.matriz-calculator-section,
.matriz-container,
.matriz-input-row,
.matriz-buttons,
.matriz-examples {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===================================
   LAYOUT PRINCIPAL
   ================================== */
.matriz-calculator-section {
    margin-bottom: 3rem;
}

.matriz-header {
    text-align: center;
    margin-bottom: 2rem;
}

.matriz-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.matriz-header p {
    font-size: 1.2rem;
    color: #5a6c7d;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.matriz-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e6ed;
    overflow-x: hidden;
    max-width: 100%;
}

.matriz-inputs h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* ===================================
   SISTEMA DE ABAS ESPECÍFICO MATRIZES
   ================================== */
.matriz-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light);
    padding-bottom: 1rem;
}

.matriz-tab-btn {
    background: var(--light);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 110px;
}

.matriz-tab-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.matriz-tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--dark-primary);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* ===================================
   CONTEÚDO DAS ABAS MATRIZES
   ================================== */
.matriz-tab-content {
    display: none;
}

.matriz-tab-content.active {
    display: block;
    animation: fadeInMatrizTab 0.3s ease;
}

@keyframes fadeInMatrizTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   DISPLAY DE OPERAÇÕES MATRIZES
   ================================== */
.matriz-operation-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--light);
}

.matriz-input-group,
.matriz-result-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.matriz-input-group h4,
.matriz-result-group h4 {
    color: var(--primary);
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.matriz-operation-symbol {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    min-width: 40px;
    text-align: center;
    padding: 0.5rem;
}

/* ===================================
   MATRIZES DIFERENTES TAMANHOS
   ================================== */
.matriz-2x2,
.matriz-3x3,
.matriz-2x3,
.matriz-result-2x2,
.matriz-result-3x3,
.matriz-result-3x2 {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--light);
    border: 2px solid var(--primary);
    border-radius: 8px;
    position: relative;
}

.matriz-2x2::before,
.matriz-3x3::before,
.matriz-2x3::before,
.matriz-result-2x2::before,
.matriz-result-3x3::before,
.matriz-result-3x2::before {
    content: '[';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: var(--primary);
    font-weight: bold;
}

.matriz-2x2::after,
.matriz-3x3::after,
.matriz-2x3::after,
.matriz-result-2x2::after,
.matriz-result-3x3::after,
.matriz-result-3x2::after {
    content: ']';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: var(--primary);
    font-weight: bold;
}

.matriz-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.matriz-row input {
    width: 60px;
    padding: 0.8rem;
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 1rem;
    text-align: center;
    font-weight: 600;
    background: white;
    transition: all 0.3s ease;
}

.matriz-row input:focus {
    outline: none;
    border-color: var(--dark-primary);
    transform: scale(1.05);
    background: var(--light);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.matriz-row input:valid:not(:placeholder-shown) {
    border-color: var(--secondary);
    background: var(--light-accent);
}

.matriz-result-cell {
    display: inline-block;
    width: 60px;
    padding: 0.8rem;
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 1rem;
    text-align: center;
    font-weight: bold;
    color: var(--secondary);
    font-family: 'Courier New', monospace;
}

/* ===================================
   SELETOR DE TAMANHO DETERMINANTE
   ================================== */
.matriz-det-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.matriz-size-buttons {
    display: flex;
    gap: 0.5rem;
    background: var(--light);
    padding: 0.5rem;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

.matriz-size-btn {
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.matriz-size-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.matriz-size-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--dark-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ===================================
   CONTEÚDO DETERMINANTE
   ================================== */
.matriz-det-content {
    display: none;
}

.matriz-det-content.active {
    display: block;
    animation: fadeInDetContent 0.3s ease;
}

@keyframes fadeInDetContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.matriz-det-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--light);
}

.matriz-result-display {
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    transition: all 0.3s ease;
}

.matriz-result-display:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.matriz-result-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary);
    font-family: 'Courier New', monospace;
}

/* ===================================
   INFORMAÇÕES EXTRAS
   ================================== */
.matriz-det-info,
.matriz-posto-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
    text-align: center;
}

.matriz-det-info span,
.matriz-posto-info span {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
}

.matriz-status {
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}

.matriz-status.invertible {
    background: #c8e6c9;
    color: #2e7d32;
}

.matriz-status.non-invertible {
    background: #ffcdd2;
    color: #c62828;
}

/* ===================================
   FÓRMULA ESPECÍFICA MATRIZES
   ================================== */
.matriz-formula {
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ===================================
   EXEMPLOS E AJUDA MATRIZES
   ================================== */
.matriz-examples {
    text-align: center;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
}

.matriz-examples.hidden {
    display: none;
}

.matriz-examples p {
    margin-bottom: 1rem;
    color: #5a6c7d;
}

.matriz-example-btn {
    background: var(--light-accent);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.85rem;
}

.matriz-example-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.matriz-help {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #fff3cd;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
    transition: all 0.3s ease;
}

.matriz-help.hidden {
    display: none;
}

/* ===================================
   EXPLICAÇÃO DO CÁLCULO MATRIZES
   ================================== */
.matriz-explanation {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 12px;
    animation: slideInUp 0.5s ease;
}

.matriz-explanation h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.matriz-step {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
}

.matriz-step h4 {
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.matriz-step p {
    margin: 0.3rem 0;
    font-family: 'Courier New', monospace;
    color: #444;
}

/* ===================================
   CONTEÚDO EDUCACIONAL MATRIZES
   ================================== */
.matriz-educational-content {
    margin-top: 3rem;
}

.matriz-content-block {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e6ed;
}

.matriz-content-block h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.5rem;
}

.matriz-content-block p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
}

.matriz-content-block strong {
    color: var(--primary);
}

/* ===================================
   FORMULA DISPLAY MATRIZES
   ================================== */
.matriz-formula-display {
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.matriz-formula-display h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.matriz-formula-display .formula p {
    margin: 0.3rem 0;
    font-family: 'Courier New', monospace;
    color: var(--secondary);
    font-weight: 600;
}

/* ===================================
   GRIDS EXEMPLOS E DICAS MATRIZES
   ================================== */
.matriz-examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.matriz-example-item {
    background: var(--light-accent);
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.matriz-example-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.matriz-example-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.matriz-example-item h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.matriz-example-item p {
    color: #5a6c7d;
    font-size: 0.95rem;
    margin: 0;
}

.matriz-tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.matriz-tip-item {
    background: var(--light);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.matriz-tip-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.matriz-tip-item h4 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.matriz-tip-item p {
    color: var(--secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* ===================================
   EXEMPLO DE SOLUÇÃO MATRIZES
   ================================== */
.matriz-example-solution {
    background: var(--light-accent);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1.5rem;
}

.matriz-example-solution h4 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
}

.matriz-solution-step {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.matriz-solution-step h5 {
    color: var(--secondary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.matriz-solution-step p {
    margin: 0.3rem 0;
    font-family: 'Courier New', monospace;
    color: #444;
}

.matriz-solution-final {
    background: #c8e6c9;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1rem;
}

.matriz-solution-final h5 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.matriz-solution-final p {
    color: #2e7d32;
    margin: 0;
    font-family: inherit;
}

/* ===================================
   FAQ E CREDIBILIDADE
   ================================== */
.faq-container {
    margin-top: 1rem;
}

.faq-item {
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light);
    overflow: hidden;
}

.faq-question {
    background: var(--light);
    color: var(--primary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: var(--primary);
    color: white;
}

.faq-answer {
    padding: 1rem 1.5rem;
    background: white;
}

.faq-answer p {
    margin: 0;
    line-height: 1.6;
    color: #444;
}

.credibilidade-container {
    background: var(--light);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
}

.credibilidade-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.credibilidade-icon {
    font-size: 2rem;
    color: var(--primary);
}

.credibilidade-title {
    color: var(--primary);
    margin: 0;
    font-size: 1.3rem;
}

.credibilidade-content {
    color: #444;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.credibilidade-logo {
    color: var(--primary);
    font-weight: bold;
}

.credibilidade-badges {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.credibilidade-badge {
    background: var(--primary);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===================================
   REFERÊNCIAS
   ================================== */
.referencias-lista {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.referencia-item {
    background: var(--light);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 1.5rem;
}

.referencia-item h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.referencia-item ul {
    margin: 0;
    padding-left: 1.2rem;
    list-style-type: disc;
}

.referencia-item li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    color: #444;
}

.referencia-item li:last-child {
    margin-bottom: 0;
}

.referencia-item strong {
    color: var(--secondary);
    font-weight: 600;
}

/* ===================================
   ANIMAÇÕES MATRIZES
   ================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   RESPONSIVIDADE MATRIZES
   ================================== */
@media (max-width: 768px) {
    .matriz-header h1 {
        font-size: 2rem;
    }
    
    .matriz-tabs {
        gap: 0.3rem;
    }
    
    .matriz-tab-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        min-width: 95px;
    }
    
    .matriz-operation-display {
        gap: 1rem;
        padding: 1rem;
        flex-direction: column;
        align-items: center;
    }
    
    .matriz-row input {
        width: 50px;
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .matriz-result-cell {
        width: 50px;
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .matriz-operation-symbol {
        font-size: 1.5rem;
        min-width: 30px;
    }
    
    .matriz-result-value {
        font-size: 1.5rem;
    }
    
    .matriz-examples-grid,
    .matriz-tips-grid {
        grid-template-columns: 1fr;
    }
    
    .credibilidade-badges {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .matriz-header h1 {
        font-size: 1.8rem;
    }
    
    .matriz-container {
        padding: 1rem;
    }
    
    .matriz-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .matriz-tab-btn {
        width: 140px;
    }
    
    .matriz-operation-display {
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .matriz-row input {
        width: 45px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .matriz-result-cell {
        width: 45px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .matriz-operation-symbol {
        font-size: 1.3rem;
    }
    
    .matriz-result-value {
        font-size: 1.3rem;
    }
    
    .matriz-example-icon {
        font-size: 2rem;
    }
}