:root {
    --bg-color: #1E1E2F;
    --text-color: #0c0c0c;
    --header-bg: #2B2D42;
    --accent-color: #c0b788;
    --card-bg: #fdfdfd;
    --hover-accent: #edeaea;
    --shadow: rgba(255, 215, 0, 0.2);
		--input-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    color: var(--text-color);
    line-height: 1.6;
}

main {
    padding: 0 1rem;
    max-width: 1400px;
    margin: 0 auto;
		background: #f5f5fa;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding-bottom: 2rem;
		padding-top: 2rem;
}

.tool-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.tool-card:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow);
}

.tool-card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    color: var(--accent-color);
}

.tool-card:hover h2 {
    color: var(--bg-color);
}

.tool-card p {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.tool-card button {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-card:hover button {
    background-color: var(--bg-color);
    color: var(--accent-color);
}

.tool-card button:hover {
    background-color: var(--hover-accent);
    color: var(--bg-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--accent-color);
}

/* Tool Container Styles */
.tool-container {
    padding: 1rem;
}

.tool-container h2 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tool-container p.description {
    margin-bottom: 2rem;
    text-align: center;
    font-style: italic;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--shadow);
}

.calculate-btn {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
    font-size: 1rem;
}

.calculate-btn:hover {
    background-color: var(--hover-accent);
}

.result-container {
    margin-top: 2rem 0;
    padding: 1.5rem;
    background-color: #fbfbfd;
    border-radius: 5px;
    display: none;
}

.formula {
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

.formula-calculation {
    margin: 15px 0;
    padding: 10px;
    border-radius: 5px;
    font-size: 16px;
	color: var(--text-color);
}

.math-tex {
    font-size: 1.1em;
    color: var(--text-color);
}

mjx-container {
    display: inline-block;
    vertical-align: middle;
}

.math {
    font-size: 1.1em;
}

.result-container h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

.result-explanation {
    margin-top: 1rem;
    line-height: 1.7;
}

.save-result {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-result:hover {
    background-color: #3e8e41;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 90%;
        margin: 10% auto;
    }
}

@media (max-width: 576px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: .5rem;
    }

    .tool-card h2 {
        font-size: 1.2rem;
    }
	
	.result-container {
		padding: 1rem;
	}
	
	.formula-calculation {
		padding: 0;
	}
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-card {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }
.tool-card:nth-child(7) { animation-delay: 0.7s; }
.tool-card:nth-child(8) { animation-delay: 0.8s; }
.tool-card:nth-child(9) { animation-delay: 0.9s; }
.tool-card:nth-child(10) { animation-delay: 1s; }
.tool-card:nth-child(11) { animation-delay: 1.1s; }
.tool-card:nth-child(12) { animation-delay: 1.2s; }