/* =========================================
   MI TUTOR REXY
   TRIÁNGULO DE PASCAL
   VERSIÓN 2.2
========================================= */


/* =========================================
   CONFIGURACIÓN GENERAL
========================================= */

* {

    box-sizing: border-box;

}


body {

    margin: 0;

    padding: 30px 15px;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        linear-gradient(
            135deg,
            #eef4ff,
            #f8fbff
        );

    color: #172033;

}


/* =========================================
   CONTENEDOR PRINCIPAL
========================================= */

.pascal-widget {

    width: 100%;

    max-width: 1000px;

    margin: auto;

    background: white;

    border-radius: 20px;

    overflow: hidden;

    box-shadow:
        0 15px 45px
        rgba(20, 50, 100, .15);

}


/* =========================================
   ENCABEZADO
   COLOR INSTITUCIONAL:
   #003b31
========================================= */

.widget-header {

    display: flex;

    align-items: center;

    gap: 18px;

    padding: 22px 30px;

    background: #003b31;

    color: white;

}


/* =========================================
   LOGO
========================================= */

.logo {

    width: 70px;

    height: 70px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    background: white;

    border-radius: 12px;

    overflow: hidden;

    padding: 4px;

}


.logo img {

    width: 100%;

    height: 100%;

    object-fit: contain;

    display: block;

}


/* =========================================
   TEXTO DEL ENCABEZADO
========================================= */

.header-text {

    min-width: 0;

}


.widget-header h1 {

    margin: 0;

    font-size: 26px;

    line-height: 1.2;

}


.widget-header p {

    margin: 6px 0 0;

    opacity: .85;

    font-size: 15px;

}


/* =========================================
   CONTROLES
========================================= */

.controls {

    padding: 25px 35px;

    background: #f7faff;

    border-bottom:
        1px solid #e5edf8;

}


.control-title {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 12px;

}


.control-title span {

    font-size: 15px;

    color: #465568;

}


.control-title strong {

    color: #003b31;

    font-size: 25px;

}


input[type="range"] {

    width: 100%;

    accent-color: #003b31;

    cursor: pointer;

}


.range-labels {

    display: flex;

    justify-content: space-between;

    font-size: 12px;

    color: #7a8496;

    margin-top: 5px;

}


/* =========================================
   BINOMIO DE NEWTON
========================================= */

.binomial-section {

    margin: 25px 20px 0;

    border-radius: 15px;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            #102a43,
            #173f5f
        );

    color: white;

}


.section-title {

    padding: 13px 20px;

    font-weight: bold;

    color: #90caf9;

    border-bottom:
        1px solid
        rgba(255, 255, 255, .1);

}


.formula {

    padding: 25px 20px;

    text-align: center;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 24px;

    overflow-x: auto;

    white-space: nowrap;

}


/* =========================================
   TÉRMINOS DEL BINOMIO
========================================= */

.binomial-term {

    display: inline-block;

    padding: 6px 8px;

    border-radius: 8px;

    cursor: pointer;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease,
        box-shadow .2s ease;

}


.binomial-term:hover {

    background:
        rgba(255, 255, 255, .12);

}


.binomial-term.selected {

    background: #1976d2;

    color: white;

    transform: scale(1.08);

    box-shadow:
        0 0 18px
        rgba(33, 150, 243, .55);

}


.plus {

    opacity: .65;

}


/* =========================================
   TRIÁNGULO DE PASCAL
========================================= */

.triangle-section {

    padding: 30px 15px;

    overflow-x: auto;

}


.triangle-section h2 {

    text-align: center;

    color: #003b31;

    margin:
        0 0 5px;

}


.instruction {

    text-align: center;

    color: #7a8496;

    font-size: 14px;

    margin-bottom: 25px;

}


#triangle {

    min-width: 600px;

}


/* =========================================
   FILAS
========================================= */

.row {

    display: flex;

    justify-content: center;

    align-items: center;

    height: 48px;

}


/* =========================================
   NÚMEROS DEL TRIÁNGULO
========================================= */

.cell {

    width: 40px;

    height: 40px;

    margin: 0 4px;

    display: flex;

    justify-content: center;

    align-items: center;

    border-radius: 50%;

    background: white;

    border:
        2px solid #dce5f2;

    color: #26364d;

    font-weight: bold;

    cursor: pointer;

    transition:
        transform .2s ease,
        background .2s ease,
        color .2s ease,
        box-shadow .2s ease;

}


/* =========================================
   HOVER
========================================= */

.cell:hover {

    transform: scale(1.18);

    background: #003b31;

    border-color: #003b31;

    color: white;

    box-shadow:
        0 5px 15px
        rgba(0, 59, 49, .35);

    z-index: 5;

}


/* =========================================
   FILA SELECCIONADA
========================================= */

.cell.active {

    border-color: #75a99f;

}


/* =========================================
   NÚMERO SELECCIONADO
========================================= */

.cell.selected {

    background: #003b31;

    border-color: #003b31;

    color: white;

    transform: scale(1.25);

    box-shadow:
        0 0 0 5px
        rgba(0, 59, 49, .15),

        0 7px 20px
        rgba(0, 59, 49, .35);

    z-index: 10;

}


/* =========================================
   ANIMACIÓN
========================================= */

@keyframes pulse {

    0% {

        transform: scale(1);

    }

    50% {

        transform: scale(1.12);

    }

    100% {

        transform: scale(1);

    }

}


.cell.selected {

    animation:
        pulse .7s ease;

}


/* =========================================
   EXPLICACIÓN
========================================= */

.explanation {

    margin:
        0 20px 25px;

    padding:
        18px 20px;

    display: flex;

    align-items: center;

    gap: 15px;

    background: #f5f9ff;

    border:
        1px solid #d7e7fa;

    border-radius: 12px;

}


.explanation-icon {

    width: 45px;

    height: 45px;

    flex-shrink: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    border-radius: 50%;

    background: #e3f2fd;

    font-size: 22px;

}


.explanation strong {

    color: #003b31;

}


.explanation p {

    margin: 5px 0 0;

    color: #526173;

}


/* =========================================
   RESPONSIVE
========================================= */

@media(max-width: 650px) {


    body {

        padding:
            10px 5px;

    }


    .widget-header {

        padding: 18px;

        gap: 12px;

    }


    .logo {

        width: 58px;

        height: 58px;

    }


    .widget-header h1 {

        font-size: 20px;

    }


    .widget-header p {

        font-size: 13px;

    }


    .controls {

        padding:
            20px;

    }


    .binomial-section {

        margin:
            20px 8px 0;

    }


    .formula {

        font-size: 19px;

    }


    .triangle-section {

        padding:
            25px 5px;

    }


    #triangle {

        min-width: 500px;

    }


    .cell {

        width: 32px;

        height: 32px;

        margin:
            0 2px;

        font-size: 12px;

    }


    .row {

        height: 40px;

    }


    .explanation {

        margin:
            0 8px 15px;

    }

}