* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Header --- */
.site-header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 20px;
    font-weight: bold;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.main-nav a {
    text-decoration: none;
    color: #333;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}

.main-nav a:hover {
    background-color: #f8f9fa;
    color: #007bff;
    border-color: #e9ecef;
    transform: translateY(-2px);
}

.main-nav a:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .main-nav ul {
        gap: 0.25rem;
    }
    .main-nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

.header-search a {
    color: #333;
}

/* --- Main Content --- */
main {
    flex: 1;
    padding: 2rem 0;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
}

.calculator-wrapper {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.calculator {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.display {
    margin-bottom: 1rem;
}

#display {
    width: 100%;
    height: 60px;
    font-size: 24px;
    text-align: right;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.buttons {
    display: grid;
    gap: 0.5rem;
}

#scientific-calculator .buttons {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.buttons button {
    padding: 1rem;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.buttons button:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.buttons button:active {
    transform: translateY(0);
}

.buttons button.op {
    background-color: #f0f0f0;
    font-weight: bold;
}

.buttons button.func {
    background-color: #e6f7ff;
    color: #007bff;
}

.buttons button.equals {
    grid-row: span 1;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.buttons button.equals:hover {
    background-color: #0069d9;
}

.content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.content h2 {
    color: #333;
    margin: 1.5rem 0 1rem;
}

.content h3 {
    color: #444;
    margin: 1rem 0;
}

.content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.content th, .content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.content th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* --- Footer --- */
.site-footer {
    background-color: #333;
    color: #fff;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #fff;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #444;
}

/* --- Other Calculator Styles --- */
.fraction-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.fraction input {
    width: 80px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.operator select {
    width: 60px;
    height: 40px;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.calculate-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 18px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.result {
    margin-top: 1rem;
    text-align: center;
}

.percentage-calculator {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.calc-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
