/* ===================== */
/* LAYOUT */
/* ===================== */
.matrix-layout {
    display: flex;
    max-width: 1700px;
    margin: 40px auto;
    padding: 0 25px;
    gap: 30px;
    align-items: flex-start;
}

/* ===================== */
/* MAIN CONTENT */
/* ===================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ===================== */
/* SIDEBAR */
/* ===================== */
.sidebar {
    position: sticky;
    top: 30px;
    width: 310px;
    min-width: 310px;
    background: white;
    border-radius: 30px;
    padding: 28px 22px;
    box-shadow:
        0 15px 50px rgba(0,0,0,.08);
    border: 1px solid #f3f4f6;
}

.sidebar-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 2px solid #fee2e2;
}

.sidebar-header h3 {
    color: #991b1b;
    font-size: 24px;
    font-weight: 800;
}

/* ===================== */
/* SIDEBAR OPTIONS */
/* ===================== */
.sidebar-option {
    border: none;
    width: 100%;
    padding: 18px 20px;
    border-radius: 22px;
    cursor: pointer;
    background: #fff5f5;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 700;
    font-size: 16px;
    text-align: left;
    transition: .3s ease;
    margin-bottom: 14px;
}

.sidebar-option i {
    font-size: 20px;
    width: 24px;
}

.sidebar-option:hover {
    transform: translateX(8px);
    background: #fee2e2;
}

.sidebar-option.active {
    background:
        linear-gradient(
            135deg,
            #ef4444,
            #b91c1c
        );

    color: white;

    box-shadow:
        0 15px 30px rgba(239,68,68,.25);
}

/* ===================== */
/* SCREEN SYSTEM */
/* ===================== */
.screen {
    display: none;
}

.active-screen {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ===================== */
/* CARDS */
/* ===================== */
.card {
    background: white;
    border-radius: 30px;
    padding: 35px;
    box-shadow:
        0 12px 35px rgba(0,0,0,.06);
    border: 1px solid #f3f4f6;
}

/* ===================== */
/* TITLES */
/* ===================== */
.section-title h2 {
    font-size: 36px;
    color: #991b1b;
    margin-bottom: 10px;
}

.section-title p {
    color: #6b7280;
    font-size: 16px;
    line-height: 1.8;
}

.card-header {
    margin-bottom: 30px;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 24px;
    color: #991b1b;
}

.card-header i {
    color: #ef4444;
}

/* ===================== */
/* MATRIX SIZE CONTROL */
/* ===================== */
.matrix-size-control {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
}

.matrix-size-control button {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    color: white;
    font-size: 18px;
    transition: .3s;
    background:
        linear-gradient(
            135deg,
            #ef4444,
            #b91c1c
        );
}

.matrix-size-control button:hover {
    transform: scale(1.08);
}

#matrix-size-display {
    font-size: 34px;
    font-weight: 800;
    color: #991b1b;
}

/* ===================== */
/* MATRIX */
/* ===================== */
.matrix-card {
    overflow-x: auto;
}

.matrix-area {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 380px;
    padding: 40px 20px;
}

.matrix-name {
    font-size: 52px;
    font-weight: 800;
    color: #991b1b;
    margin-right: 24px;
}

.matrix-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ===================== */
/* MATRIX BRACKETS */
/* ===================== */
.matrix-bracket {

    display: flex;

    align-items: center;

    font-size:
        clamp(
            120px,
            12vw,
            220px
        );

    line-height: .7;

    color: #b91c1c;

    font-weight: 200;
}

/* ===================== */
/* MATRIX GRID */
/* ===================== */
.matrix-grid {
    display: grid;
    gap: 16px;
}

/* ===================== */
/* MATRIX INPUT */
/* ===================== */
.matrix-input {
    width: 90px;
    height: 72px;
    border: 2px solid #fecaca;
    border-radius: 18px;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    background: #fff5f5;
    transition: .25s ease;
    outline: none;
    color: #7f1d1d;
}

.matrix-input::placeholder {
    color: #d1d5db;
}

.matrix-input:focus {
    border-color: #ef4444;
    background: white;
    transform: scale(1.06);

    box-shadow:
        0 12px 30px rgba(239,68,68,.18);
}

/* ===================== */
/* METHOD SELECT */
/* ===================== */
.method-select-wrapper {
    display: flex;
    justify-content: center;
}

.method-select {
    width: 100%;
    max-width: 520px;
    padding: 20px 24px;
    border-radius: 20px;
    border: 2px solid #fecaca;
    background: #fff5f5;
    font-size: 18px;
    font-weight: 700;
    color: #991b1b;
    outline: none;
    cursor: pointer;
    transition: .25s;
}

.method-select:focus {
    border-color: #ef4444;
    background: white;
}

/* ===================== */
/* PROCEDURE */
/* ===================== */
.procedure-placeholder {
    min-height: 320px;
    border-radius: 28px;
    border: 3px dashed #fecaca;
    background:
        linear-gradient(
            180deg,
            #fff5f5,
            white
        );

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 18px;
    padding: 40px;
}

.procedure-placeholder i {
    font-size: 72px;
    color: #ef4444;
    opacity: .25;
}

.procedure-placeholder h4 {
    color: #991b1b;
    font-size: 28px;
}

.procedure-placeholder p {
    color: #6b7280;
    max-width: 520px;
    line-height: 1.8;
}

/* ===================== */
/* PLACEHOLDER SCREENS */
/* ===================== */
.placeholder-card {
    min-height: 700px;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 22px;
    text-align: center;
    min-height: 620px;
}

.placeholder-content i {
    font-size: 95px;
    color: #ef4444;
    opacity: .2;
}

.placeholder-content h2 {
    font-size: 38px;
    color: #991b1b;
}

.placeholder-content p {
    color: #6b7280;
    font-size: 18px;
}

/* ===================== */
/* NAV ACTIVE */
/* ===================== */
.nav-links a.active {
    background:
        rgba(255,255,255,.15);

    border-radius: 12px;
}

/* ===================== */
/* PREMIUM SCROLLBAR */
/* ===================== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #fee2e2;
    border-radius: 50px;
}

::-webkit-scrollbar-thumb {
    background:
        linear-gradient(
            180deg,
            #ef4444,
            #b91c1c
        );

    border-radius: 50px;
}

::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(
            180deg,
            #dc2626,
            #991b1b
        );
}

/* ===================== */
/* RESPONSIVE */
/* ===================== */
@media(max-width:1200px){

    .matrix-layout{
        flex-direction: column;
    }

    .sidebar{
        position: static;
        width: 100%;
        min-width: unset;
    }
}

@media(max-width:768px){

    .card{
        padding: 25px;
    }

    .section-title h2{
        font-size: 28px;
    }

    .matrix-area{
        min-height: 260px;
        padding: 20px 0;
    }

    .matrix-name{
        font-size: 36px;
    }

    .matrix-bracket{
        font-size: 140px;
    }

    .matrix-input{
        width: 64px;
        height: 56px;
        font-size: 18px;
    }

    #matrix-size-display{
        font-size: 26px;
    }

    .placeholder-content h2{
        font-size: 30px;
    }
}

/* ===================== */
/* SOLVE BUTTON */
/* ===================== */
.solve-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.solve-btn {
    border: none;
    cursor: pointer;
    border-radius: 22px;
    padding: 18px 34px;
    font-size: 18px;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: .25s ease;

    background:
        linear-gradient(
            135deg,
            #ef4444,
            #b91c1c
        );

    box-shadow:
        0 15px 30px rgba(239,68,68,.25);
}

.solve-btn:hover {
    transform:
        translateY(-3px)
        scale(1.02);
}

.solve-btn:active {
    transform: scale(.98);
}

/* ===================== */
/* RESULTADO FINAL */
/* ===================== */
.determinant-result {
    margin-bottom: 30px;
}

.result-card {
    background:
        linear-gradient(
            135deg,
            #fff5f5,
            white
        );

    border: 2px solid #fecaca;
    border-radius: 28px;
    padding: 28px;
    text-align: center;
}

.result-card h3 {
    color: #991b1b;
    font-size: 22px;
    margin-bottom: 14px;
}

.result-value {
    font-size: 42px;
    font-weight: 900;
    color: #b91c1c;
}

/* ===================== */
/* PROCEDURE CONTENT */
/* ===================== */
.procedure-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ===================== */
/* STEP CARD */
/* ===================== */
.step-card {
    background: white;
    border-radius: 28px;
    border: 2px solid #fee2e2;
    padding: 30px;
    box-shadow:
        0 10px 25px rgba(0,0,0,.05);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.step-number {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background:
        linear-gradient(
            135deg,
            #ef4444,
            #b91c1c
        );

    color: white;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
}

.step-title {
    font-size: 24px;
    font-weight: 800;
    color: #991b1b;
}

.step-operation {
    background: #fff5f5;
    border-radius: 18px;
    padding: 18px 22px;
    font-size: 22px;
    font-weight: 700;
    color: #7f1d1d;
    margin-bottom: 25px;
    overflow-x: auto;
}

/* ===================== */
/* MATRIX VISUAL STEP */
/* ===================== */
.step-matrix-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
}

.step-matrix-wrapper {
    display: flex;
    align-items: center;
    gap: 18px;
}

.step-bracket {
    font-size: 180px;
    line-height: .7;
    color: #b91c1c;
    font-weight: 200;
}

.step-matrix {
    display: grid;
    gap: 14px;
}

.step-cell {
    min-width: 70px;
    height: 60px;
    background: #fff5f5;
    border: 2px solid #fecaca;
    border-radius: 16px;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 24px;
    font-weight: 700;
    color: #7f1d1d;
}

/* ===================== */
/* EMPTY STATE */
/* ===================== */
.empty-message {
    text-align: center;
    color: #6b7280;
    font-size: 18px;
}

/* ===================== */
/* MOBILE */
/* ===================== */
@media(max-width:768px){

    .solve-btn{
        width: 100%;
        justify-content: center;
    }

    .step-title{
        font-size: 20px;
    }

    .step-operation{
        font-size: 18px;
    }

    .step-bracket{
        font-size: 120px;
    }

    .step-cell{
        min-width: 52px;
        height: 52px;
        font-size: 18px;
    }

    .result-value{
        font-size: 32px;
    }
}

/* ===================== */
/* LATEX MATRIX */
/* ===================== */
.step-latex-matrix {

    overflow-x: auto;

    padding: 20px;

    border-radius: 20px;

    background:
        linear-gradient(
            180deg,
            #fff5f5,
            white
        );

    border:
        2px solid #fee2e2;
}

/* ===================== */
/* MATHJAX */
/* ===================== */
.MathJax {

    font-size: 1.35rem !important;
}

/* ===================== */
/* RESULT LATEX */
/* ===================== */
.result-value .MathJax {

    font-size: 2.2rem !important;
}

/* ===================== */
/* STEP OPERATION */
/* ===================== */
.step-operation {

    overflow-x: auto;
}

/* ===================== */
/* MATRICES GRANDES */
/* ===================== */
.step-card {

    overflow-x: auto;
}

/* ===================== */
/* PIVOT INFO */
/* ===================== */
.pivot-info {

    margin-bottom: 18px;

    padding: 14px 18px;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            #fee2e2,
            #fff5f5
        );

    color: #991b1b;

    font-weight: 700;

    border:
        2px solid #fecaca;
}

/* ===================== */
/* STEP DESCRIPTION */
/* ===================== */
.step-description {

    color: #6b7280;

    font-size: 15px;

    margin-bottom: 18px;

    line-height: 1.7;
}

/* ===================== */
/* ANIMATION */
/* ===================== */
.step-card {

    animation:
        fadeUp .4s ease;
}

@keyframes fadeUp {

    from {

        opacity: 0;

        transform:
            translateY(18px);
    }

    to {

        opacity: 1;

        transform:
            translateY(0);
    }
}

/* ===================== */
/* BETTER RESULT */
/* ===================== */
.result-card {

    position: relative;

    overflow: hidden;
}

.result-card::before {

    content: "";

    position: absolute;

    inset: 0;

    background:
        linear-gradient(
            135deg,
            rgba(239,68,68,.05),
            transparent
        );

    pointer-events: none;
}

/* ===================== */
/* LATEX RESPONSIVE */
/* ===================== */
.step-latex-matrix {

    overflow-x: auto;

    overflow-y: hidden;
}

/* ===================== */
/* MOBILE FIX */
/* ===================== */
@media(max-width:768px){

    .step-card{

        padding: 22px;
    }

    .step-operation{

        font-size: 16px;
    }

    .pivot-info{

        font-size: 14px;
    }
}