/* Reset and base styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --primary-color: #0070f3;
    --secondary-color: #00c7ff;
    --tertiary-color: #7928ca;
    --accent-color: #ff4d4d;
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --background-dark: #000000;
    --background-darker: rgba(0, 0, 0, 0.7);
    --background-light: rgba(255, 255, 255, 0.05);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(0, 112, 243, 0.3);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--tertiary-color));
    --gradient-accent: linear-gradient(to right, var(--accent-color), var(--secondary-color));
    --gradient-background: linear-gradient(135deg, #000, #111, #000);
    --glow-strength: 8px;
}

body {
    background: var(--gradient-background);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 6rem;
    font-size: 1rem;
}

/* Glassmorphism elements */
.glass-effect {
    background: var(--background-light);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color);
}

/* Navbar styles */
.navbar {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 62.5rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 1.5rem rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border: none;
}

.navbar_container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

a#navbar_logo {
    color: var(--text-color) !important;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

a#navbar_logo:hover {
    color: var(--primary-color) !important;
}

.navbar_menu {
    display: flex;
    list-style: none;
    gap: 24px;
}

.navbar_item {
    margin: 0;
}

.navbar_links {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 6px;
}

.navbar_links:hover {
    background: var(--background-light);
    color: var(--text-color);
}

.navbar_btn .button {
    background: var(--primary-color);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar_btn .button:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

/* Container and layouts */
.container {
    width: 90%;
    max-width: 75rem;
    margin: auto;
    padding: 1.25rem;
}

/* Calculator styles */
.calculate {
    width: 100%;
    max-width: 20rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 1px solid var(--border-light);
}

.calculate h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calculate input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-light);
    background: var(--background-darker);
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.calculate input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--border-glow);
}

/* Flex container for label and input */
.decimal-accuracy-container {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Align label and input */
    margin-bottom: 1rem;
    width: 100%; /* Ensure full width for alignment */
}

.displayAccuracy {
    width: 4rem !important;
    height: 2rem;
    font-size: 0.85rem;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--background-darker);
    color: var(--text-color);
    border-radius: 0.375rem;
    padding: 0 0.25rem;
    outline: none;
    transition: all 0.2s ease;
    font-family: 'Inter', monospace;
}

.displayAccuracy:hover,
.displayAccuracy:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--border-glow);
}

label[for="displayAccuracy"] {
    display: inline-block;
    color: var(--text-color);
    font-size: 0.95rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.display {
    width: 100%;
    height: 4.375rem;
    font-size: 1.8rem;
    text-align: right;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: var(--background-darker);
    color: var(--text-color);
    border: 1px solid var(--border-light);
    box-shadow: inset 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    outline: none;
    transition: all 0.2s ease;
    font-family: 'Inter', monospace;
}

.display:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--border-glow);
}

.option {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 0.5rem;
}

.option button {
    height: 3.125rem;
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    background: var(--background-light);
    color: var(--text-color);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.option button:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.option button:active {
    transform: translateY(1px);
}

.option button.operator {
    background: rgba(0, 112, 243, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    border: 1px solid rgba(0, 112, 243, 0.2);
}

.option button.operator:hover {
    background: rgba(0, 112, 243, 0.2);
    color: var(--text-color);
}

.option button.operator_equal {
    background: var(--primary-color);
    color: white;
    grid-column: span 3;
    font-weight: 600;
}

.option button.operator_equal:hover {
    background: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(0, 112, 243, 0.3);
}

.option button.operator_different {
    background: var(--accent-color);
    color: white;
    grid-column: span 2;
    font-weight: 600;
}

/* Hero section and feature cards */
.hero-section {
    text-align: center;
    padding: 2.5rem 0;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--text-color), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.0625rem;
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 37.5rem;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18.75rem, 1fr));
    gap: 1.5rem;
    padding: 1.25rem 0;
}

.feature-card {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 16px 0 12px;
    color: var(--text-color);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.feature-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.feature-card .button {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.feature-card .button:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

/* Calculator container */
.calculator-container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    gap: 30px;
    height: calc(100vh - 200px); /* Account for header and footer */
    padding: 0 2rem;
}

.plot-container {
    background: var(--background-darker);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
    flex: 1;
    min-height: 0; /* Important for flex container */
    display: flex;
    flex-direction: column;
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    position: static;
    margin-bottom: 5px;
    color: var(--text-color);
    background: transparent;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--background-darker);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px var(--primary-color);
    outline: none;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    background: var(--background-light);
    color: var(--text-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    margin-top: 2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 10px var(--primary-color);
}

.chart-wrapper {
    flex: 1;
    min-height: 0; /* Important for flex container */
    width: 100%;
    position: relative;
    overflow: hidden; /* Prevent overflow */
}

canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Info page styles */
.info-container {
    max-width: 50rem;
    margin: 0 auto;
    padding: 1.25rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5625rem;
    border-radius: 0.9375rem;
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.875rem;
}

.info-card h2 {
    color: #f9a825;
    margin-bottom: 0.9375rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.625rem;
}

.function-list {
    list-style-type: none;
    padding: 0;
}

.function-list li {
    margin-bottom: 0.9375rem;
    padding-left: 1.25rem;
    position: relative;
}

.function-list li:before {
    content: "•";
    color: #f9a825;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.key {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: monospace;
    margin: 0 0.125rem;
}

.example {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.625rem;
    border-radius: 0.5rem;
    margin: 0.625rem 0;
    font-family: monospace;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 60px;
    border-top: 1px solid var(--border-light);
}

/* Responsive styles */
@media (min-width: 768px) {
    .calculator-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 40px;
        align-items: start;
    }

    .calculate {
        width: 100%;
        max-width: 400px;
    }

    .plot-container {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .calculator-layout {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

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

@media (max-width: 480px) {
    .calculate {
        width: 100%;
        padding: 20px;
    }

    .option {
        grid-gap: 6px;
    }

    .option button {
        height: 45px;
        font-size: 1em;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }
}

@media screen and (max-width: 960px) {
    .navbar_menu {
        display: none;
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-light);
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }

    .navbar_menu.active {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    #navbar_logo {
        font-size: 1.1rem;
    }

    .navbar_toggle .bar {
        width: 24px;
        height: 2px;
        background: var(--text-color);
        margin: 6px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .navbar_item {
        width: 100%;
        text-align: center;
    }

    .navbar_links {
        display: block;
        padding: 12px;
        width: 100%;
        border-radius: 6px;
    }

    #mobile-menu {
        display: block;
        cursor: pointer;
    }

    .navbar_btn {
        width: 100%;
        text-align: center;
    }

    .button {
        display: inline-block;
        padding: 10px 20px;
        width: 100%;
        text-align: center;
    }

    #mobile-menu.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    #mobile-menu.is-active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    #mobile-menu.is-active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* Remove inline styles from HTML files */
.hero-title {
    color: var(--text-color);
    text-align: center;
    margin: 40px 0;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.angle-select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-light);
    background: var(--background-darker);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.angle-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--border-glow);
}
