:root {
    --color-grey: #666;
    --color-grey-light: #e6e6e6;
    --color-purple: #393a57;
    --color-light-purple: #5A5D81;
    --color-red: #CB696A;
    --color-light: #F2F5FC;
    --color-dark: #1a1a2e;
    --color-dark-secondary: #2d2d44;
    --white: #ffffff;
    --footer-bg: #374151;
    --black: #333333;
}

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

/* Theme */
.theme {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.theme--light {
    background-color: var(--color-light);
    color: var(--color-text-primary);
}

.theme--dark {
    background-color: var(--color-dark);
    color: var(--white);
}

/* Header */
.header {
    background-color: transparent;
    transition: all 0.3s ease;
}

.theme--dark .header {
    background-color: var(--color-dark-secondary);
}

.header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-text-primary);
}

.theme--dark .header__title {
    color: var(--white);
}

/* Navbar */
nav ul {
    display: flex;
    flex-direction: row;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav li {
    margin-bottom: 0;
    margin-right: 0.75rem;
}

nav ul li a {
    position: relative;
    overflow: hidden;
    border: .1rem solid transparent;
    border-radius: 8px;
    color: var(--color-light-purple);
    padding: 8px;
    background-color: transparent;
    transition: color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    z-index: 0;
    margin: .7rem 0;
    text-decoration: none;
}

nav ul li a:hover {
    background-color: var(--color-light-purple);
    color: var(--color-light);
    box-shadow: 0 8px 16px rgba(90, 93, 129, 0.25);
    transform: translateY(-2px);
}

.theme--dark nav ul li a {
    color: var(--white);
}

.theme--dark nav ul li a:hover {
    background-color: rgba(236, 233, 252, 0.15);
    color: var(--color-light);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.navbar {
    display: flex;
    align-items: center;
}

.menu-icon {
    display: none;
    align-items: center;
    cursor: pointer;
}

.menu-icon img {
    width: 32px;
    height: 32px;
}

.overlay {
    display: none;
    position: fixed;
    background-color: rgba(0, 0, 0, .5);
    height: 100%;
    left: 0;
    top: 0;
    width: 100%;
    z-index: 4;
    cursor: pointer;
}

.overlay.show {
    display: block;
}

.sidenav {
    display: none;
}

.sidenav.show {
    display: block;
}

/*Menu calculadora*/
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.keypad-num,
.keypad-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, rgba(242, 245, 252, 0.85) 0%, rgba(210, 213, 233, 0.9) 100%);
    border: 1px solid rgba(90, 93, 129, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-purple);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    text-transform: lowercase;
    appearance: none;
    outline: none;
}

.keypad-delete img {
    width: 2rem;
    height: 2rem;
}

.keypad-delete {
    border: 1px solid var(--color-red);
}

.keypad-num[value="sin"],
.keypad-num[value="cos"],
.keypad-num[value="tan"],
.keypad-num[value="log"],
.keypad-num[value="exp"] {
    text-transform: uppercase;
}

.keypad-num:hover,
.keypad-delete:hover {
    transform: translateY(-2px);
    box-shadow: rgba(99, 99, 99, .2) 0rem 2px 8px 0rem;
    background: linear-gradient(160deg, rgba(90, 93, 129, 0.15) 0%, rgba(57, 58, 87, 0.15) 100%);
    color: var(--color-light);
}

.keypad-num:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}

.keypad-num:focus-visible {
    outline: 3px solid rgba(90, 93, 129, 0.45);
    outline-offset: 3px;
}

/* Toggle */
.toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle__icon {
    font-size: 0.875rem;
    color: var(--color-grey);
}

.theme--dark .toggle__icon {
    color: #ccc;
}

.toggle__button {
    position: relative;
    display: inline-flex;
    height: 1.5rem;
    width: 2.75rem;
    align-items: center;
    border-radius: 9999px;
    background-color: #d1d5db;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    outline: none;
}

.toggle__button:focus {
    box-shadow: 0 0 0 2px var(--color-purple);
}

.toggle__button--active {
    background-color: var(--color-purple);
}

.toggle__circle {
    display: inline-block;
    height: 1rem;
    width: 1rem;
    border-radius: 50%;
    background-color: var(--white);
    transition: transform 0.3s ease;
    transform: translateX(0.25rem);
}

.toggle__circle--active {
    transform: translateX(1.5rem);
}

/* Main */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

.main__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.compare__grid {
    grid-template-columns: 1fr;
}

.comparison-section {
    display: grid;
    gap: 1.5rem;
}

.comparison-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
}


/** EXAMPLE*/
.section-card {
    background-color: var(--white);
    border-radius: 0.75rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.theme--dark .section-card {
    background-color: var(--color-dark-secondary);
}

.section-card__title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--color-purple);
    border-bottom: 3px solid var(--color-red);
    padding-bottom: 0.5rem;
}

.theme--dark .section-card__title {
    color: var(--color-grey-light);
}

/* Title Section */
.title-section {
    text-align: center;
    padding: 0 0 2rem 0;
}

.title-section__title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-purple);
}

.theme--dark .title-section__title {
    color: var(--color-grey-light);
}

.title-section__subtitle {
    font-size: 1.25rem;
    color: var(--color-grey);
}

.theme--dark .title-section__subtitle {
    color: var(--color-light);
}

/*Table comparison*/
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
}

.badge--success {
    background-color: #10b981;
}

.badge--warning {
    background-color: #f59e0b;
}

.badge--info {
    background-color: #3b82f6;
}

.comparison-table {
    width: 100%;
    margin: 2rem 0;
    border-radius: 0.5rem;
    border-collapse: collapse;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.comparison-table th {
    background-color: var(--color-purple);
    color: var(--white);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-light);
}

.theme--dark .comparison-table td {
    border-bottom: 1px solid var(--color-light-purple);
}

.problem-context,
.results-info {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 4px solid #10b981;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    gap: 0.7rem;
}

.theme--dark .problem-context,
.theme--dark .results-info {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
}

.problem-context ul,
.results-info ul,
.interpretation-box ul {
    margin-left: 1.5rem;
}


.problem-context ul li,
.results-info ul li,
.interpretation-box ul li {
    line-height: 1.5rem;
}

.problem-context__title,
.results-info__title {
    font-weight: bold;
    color: #059669;
    display: flex;
    align-items: center;
}

.real-world-impact {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.theme--dark .problem-context.real-world-impact {
    background-color: rgba(245, 158, 11, 0.1);
}

.impact__title {
    color: #d97706;
}

.example-interactive {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--color-purple);
}

.theme--dark .example-interactive {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

.example-interactive__title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-purple);
    margin-bottom: 0.5rem;
}

.theme--dark .example-interactive__title {
    color: #a78bfa;
}

.example-interactive__subtitle {
    color: var(--color-grey);
    font-style: italic;
}

.theme--dark .example-interactive__subtitle {
    color: #d1d5db;
}

.example-interactive__equation {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    margin: 1rem 0;
    text-align: center;
}

.example-interactive__params {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 0.5rem;
}

.theme--dark .example-interactive__params {
    background-color: rgba(0, 0, 0, 0.2);
}

.example-interactive__param {
    display: flex;
    flex-direction: column;
}

.param-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-purple);
}

.theme--dark .param-label {
    color: #a78bfa;
}

.param-value {
    font-family: 'Courier New', monospace;
}

.button--biseccion {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.button--biseccion:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.results-container {
    margin-top: 2rem;
    display: none;
}

.results-container.active {
    display: block;
}

.interpretation-box {
    background-color: #ede9fe;
    border-left: 4px solid #8b5cf6;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
}

.theme--dark .interpretation-box {
    background-color: rgba(139, 92, 246, 0.1);
}

.interpretation-box__title {
    font-weight: bold;
    color: #7c3aed;
    margin-bottom: 0.5rem;
}



/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.input-section__label {
    display: block;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--black);
    margin-bottom: 1rem;
}

.theme--dark .input-section__label {
    color: var(--white);
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    background-color: var(--white);
    color: var(--black);
    margin-bottom: 1rem;
}

.form-control--small {
    padding: 0.5rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.theme--dark .form-control {
    border-color: #4b5563;
    background-color: var(--footer-bg);
    color: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Button */
.button {
    background-color: var(--color-purple);
    color: var(--white);
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: 0;
    font-size: 1.125rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.button--full {
    width: 100%;
    margin-top: 1.5rem;
}

.button:hover {
    background-color: var(--color-light-purple);
}

/*Select*/
select {
    appearance: none;
    background-image: url('../imgs/icons/arrow.png');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 30px;
}

/* Parameters */
.parameters {
    margin-top: 1rem;
    border-radius: 10px;
}

.parameters__group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.parameters__field {
    flex: 1;
    min-width: 120px;
}

/* Image Section */
.image-section {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-section__img {
    max-width: 100%;
    height: auto;
    width: 100%;
    max-width: 400px;
}

/* Results Table */
.data {
    margin-bottom: .5rem;
}

.charts-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.chart-card {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 640px;
    width: 100%;
}

.theme--dark .chart-card {
    background-color: var(--color-dark-secondary);
}

.chart-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-dark);
}

.theme--dark .chart-card__title {
    color: var(--color-light);
}

.chart-card__canvas-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chart-funcion {
    display: block;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

.results-table {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.results-table__wrapper,
.table-example {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.results-table__table,
.comparison-table {
    min-width: 560px;
    /* ajustá según el contenido */
}

.theme--dark .results-table {
    background-color: var(--color-dark-secondary);
}

.results-table__wrapper {
    overflow-x: auto;
}

.results-table__table {
    width: 100%;
    border-collapse: collapse;
}

.results-table__header {
    background-color: var(--color-purple);
    color: var(--white);
}

.results-table__th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
}

.results-table__row {
    transition: background-color 0.2s ease;
}

.results-table__row:hover {
    background-color: var(--color-red);
}

.theme--dark .results-table__row:hover {
    background-color: #4c1d95;
}

.results-table__td,
.comparison-table {
    padding: 0.75rem 1rem;
    color: var(--black);
    line-height: 1.8;
}

.theme--dark .results-table__td,
.theme--dark .comparison-table {
    color: var(--color-grey-light);
}

/* Footer */
.footer {
    background-color: var(--footer-bg);
    color: var(--white);
    margin-top: 2rem;
}

.footer__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
}

.footer__title {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.footer__subtitle {
    color: #d1d5db;
    margin-bottom: 0.5rem;
}

.footer__copyright {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Modal */
.modal-overlay {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 4;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -60%);
    transition: all 0.4s ease;
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 18rem;
    max-width: 45rem;
    max-height: 80vh;
    padding: 18px;
    box-shadow: rgba(99, 99, 99, 0.2) 0rem 0.2rem 0.8rem 0rem;
    border-radius: 1.2rem;
    background-color: var(--color-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    gap: 1rem;
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.modal__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal .modal__header-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.modal .modal__header-icon.information {
    background-color: #d8dcfb;
}

.modal .modal__header-icon.warning {
    background-color: #fffeef;
}

.modal .modal__header-icon.danger {
    background-color: #fee2e1;
}

.modal .modal__header-icon.correct {
    background-color: #EBFAEF;
}

.modal .modal__body {
    display: inherit;
    flex-direction: inherit;
    align-items: center;
    text-align: center;
    color: var(--color-grey);
    gap: 1rem;
}

.modal__body-actions .cancel-button {
    font-size: 16px;
    font-weight: bold;
    padding: 0.8rem 5rem;
    background-color: transparent;
    border-radius: 10px;
    border: 1px var(--color-grey-light) solid;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal__body-actions button:hover {
    background-color: var(--color-grey-light);
}

.theme--dark #modal__header-title {
    color: var(--color-dark);
}

.visually-hidden {
    visibility: hidden;
}

@media (max-width: 768px) {
    .main {
        padding: 1.5rem 1rem;
    }

    .main__grid {
        grid-template-columns: 1fr;
    }

    .section-card {
        padding: 1.25rem;
    }
}

@media screen and (max-width: 768px) {
    .main {
        padding: 1.5rem 1rem;
    }

    .results-table__table,
    .comparison-table {
        min-width: 480px;
        font-size: 0.9rem;
    }

    .header__container {
        flex-direction: row-reverse;
    }

    .navbar {
        display: none;
    }

    .menu-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }

    .sidenav {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        position: fixed;
        right: 0;
        top: 0;
        width: min(320px, 80vw);
        height: 100%;
        padding: 3.5rem 2rem 2.5rem;
        background: linear-gradient(160deg, rgba(57, 58, 87, 0.97) 0%, rgba(26, 26, 46, 0.94) 100%);
        box-shadow: -16px 0 32px rgba(0, 0, 0, 0.28);
        border-top-left-radius: 1.5rem;
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.35s ease, opacity 0.35s ease;
        z-index: 100;
    }

    .theme--dark .sidenav {
        background: linear-gradient(160deg, rgba(29, 31, 56, 0.98) 0%, rgba(19, 19, 36, 0.96) 100%);
        box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
    }

    .sidenav.show {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .sidenav a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 1rem;
        font-weight: 500;
        color: var(--color-light);
        text-decoration: none;
        padding: 0.85rem 1rem;
        border-radius: 0.85rem;
        transition: background-color 0.25s ease, transform 0.25s ease;
    }

    .sidenav a::before {
        content: '';
        display: inline-flex;
        width: 0.45rem;
        height: 0.45rem;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.45);
        transition: background-color 0.25s ease;
    }

    .sidenav a:hover,
    .sidenav a:focus {
        background-color: rgba(242, 245, 252, 0.18);
        transform: translateX(-4px);
    }

    .sidenav a:hover::before,
    .sidenav a:focus::before {
        background-color: var(--color-red);
    }

    .sidenav .closebtn {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        font-size: 2.5rem;
        color: var(--color-light);
        cursor: pointer;
        transition: transform 0.3s ease;
    }

    .sidenav .closebtn:hover,
    .sidenav .closebtn:focus {
        transform: scale(1.05);
    }

    .keypad-num,
    .keypad-delete {
        padding: 0.5rem;
    }
}