/* ===================================
   CSS Variables & Root Styles
   =================================== */
:root {
    /* Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --accent-color: #4F46E5;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2e2e2e;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-tertiary: #6c757d;
    --border-color: #404040;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ===================================
   Base Styles & Reset
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

/* ===================================
   Header & Navigation
   =================================== */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.logo i {
    font-size: 1.5rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.nav-link.active::after,
.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 250px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    padding: 8px;
}

.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    background: linear-gradient(135deg, var(--accent-color) 0%, #7c3aed 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.6s ease;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    animation: fadeInUp 0.8s ease;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: white;
    color: var(--accent-color);
    animation: fadeInUp 1s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ===================================
   Tools Section
   =================================== */
.tools-section {
    padding: 5rem 0;
    background-color: var(--bg-secondary);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-subtitle {
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

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

.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--tool-color, var(--accent-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--tool-color, var(--accent-color));
}

.tool-icon {
    width: 60px;
    height: 60px;
    background: var(--tool-color, var(--accent-color));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
}

.tool-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tool-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    color: var(--tool-color, var(--accent-color));
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.tool-card:hover .tool-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ===================================
   FAQ Section
   =================================== */
.faq-section {
    padding: 5rem 0;
    background-color: var(--bg-primary);
}

.faq-accordion {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 1.25rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.0625rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: var(--bg-tertiary);
}

.faq-question i {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer p {
    padding: 0 1.5rem 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.footer-logo i {
    font-size: 1.5rem;
}

.footer-tagline {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-links a {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-3px);
}

.footer-heading {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.625rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* ===================================
   Tool Page Styles
   =================================== */
.tool-page {
    padding: 3rem 0;
}

.tool-header {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--tool-color, var(--accent-color)) 0%, var(--tool-color-dark, #7c3aed) 100%);
    color: white;
    margin-bottom: 3rem;
}

.tool-page-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.tool-page-description {
    font-size: 1.125rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto;
}

.tool-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

.tool-interface {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.tool-interface h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9375rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--tool-color, var(--accent-color));
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-calculate {
    width: 100%;
    padding: 1rem;
    background: var(--tool-color, var(--accent-color));
    color: white;
    border-radius: 8px;
    font-size: 1.0625rem;
    font-weight: 600;
    margin-top: 1rem;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-result {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

.result-box {
    background: var(--bg-primary);
    border: 2px solid var(--tool-color, var(--accent-color));
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-top: 1.5rem;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tool-color, var(--accent-color));
    margin-bottom: 0.5rem;
}

.result-detail {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.tool-content {
    max-width: 900px;
    margin: 0 auto;
}

.content-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.content-section h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--tool-color, var(--accent-color));
}

.content-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.content-section ul,
.content-section ol {
    margin-left: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.content-section li {
    margin-bottom: 0.5rem;
}

.formula-box {
    background: var(--bg-primary);
    border-left: 4px solid var(--tool-color, var(--accent-color));
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.example-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.example-box h4 {
    color: var(--tool-color, var(--accent-color));
    margin-bottom: 0.75rem;
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1199px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 991px) {
    .nav {
        position: fixed;
        top: 73px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 73px);
        background: var(--bg-primary);
        transition: left 0.3s ease;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }

    .nav.active {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
        padding: 2rem;
        gap: 0;
    }

    .nav-list li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-link {
        display: block;
        padding: 1rem 0;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin-top: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .dropdown.active .dropdown-menu {
        max-height: 600px;
    }

    .dropdown-menu a {
        padding: 0.75rem 1rem;
    }

    .mobile-toggle {
        display: flex;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tool-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    html {
        font-size: 14px;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .tool-page-title {
        font-size: 1.75rem;
    }

    .content-section {
        padding: 1.5rem;
    }
}

@media (max-width: 479px) {
    .container {
        padding: 0 15px;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }

    .tool-interface,
    .tool-result {
        padding: 1.5rem;
    }

    .result-value {
        font-size: 2rem;
    }
}

/* ===================================
   Utility Classes
   =================================== */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.hidden {
    display: none;
}

.success-text {
    color: var(--success-color);
}

.error-text {
    color: var(--error-color);
}

.warning-text {
    color: var(--warning-color);
}