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

:root {
    --primary-green: #16a34a;
    --primary-green-dark: #15803d;
    --primary-green-light: #dcfce7;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    font-size: 16px;
}

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

/* Header Styles */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.share-container, .lang-container {
    position: relative;
}

.share-btn, .lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.share-btn:hover, .lang-btn:hover {
    background: var(--primary-green-light);
    border-color: var(--primary-green);
    color: var(--primary-green-dark);
}

/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: 100%;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
}

.share-dropdown {
    right: 0;
}

.lang-dropdown {
    right: 0;
}

.dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item:hover {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
}

.flag {
    font-size: 16px;
}

/* Main Content */
.main {
    padding: 12px 0;
}

/* Calculator Section */
.calculator-section {
    margin-bottom: 32px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.calculator-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.calculator-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-green);
}

.calculator-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    padding-right: 40px;
}

.input-suffix {
    position: absolute;
    right: 12px;
    color: var(--text-light);
    font-weight: 500;
    pointer-events: none;
}

input[type="number"], input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-primary);
    transition: var(--transition);
}

input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px var(--primary-green-light);
}

.calculate-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.calculate-btn:hover {
    background: var(--primary-green-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.calculate-btn:active {
    transform: translateY(0);
}

.result {
    padding: 16px;
    background: var(--primary-green-light);
    border: 1px solid var(--primary-green);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-green-dark);
    text-align: center;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    margin-top: 8px;
}

.result.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.result.empty {
    display: none;
    opacity: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .header-content {
        padding: 8px 0;
    }

    .site-title {
        font-size: 18px;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .calculator-card {
        padding: 16px;
    }

    .main {
        padding: 16px 0;
    }

    .share-btn, .lang-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .share-btn span, .lang-btn span {
        display: none;
    }

    .dropdown {
        right: 0;
        min-width: 180px;
    }

    .share-dropdown {
        right: 0;
    }

    .lang-dropdown {
        right: 0;
    }

    /* Hero Section Mobile */
    .hero-section {
        padding: 24px 0;
        margin-top: 16px;
    }

    .hero-title {
        font-size: 20px;
    }

    .hero-description {
        font-size: 13px;
        margin-bottom: 20px;
    }

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

    .feature-item {
        padding: 16px 12px;
    }

    .feature-icon {
        font-size: 32px;
    }

    /* FAQ Section Mobile */
    .faq-section {
        padding: 24px 0;
        margin-top: 16px;
    }

    .faq-title {
        font-size: 20px;
    }

    .faq-question {
        font-size: 14px;
        padding: 12px 16px;
    }

    .faq-answer {
        padding: 0 16px;
    }

    .faq-item.active .faq-answer {
        padding: 12px 16px;
    }

    /* Footer Mobile */
    .footer {
        padding: 24px 0 16px;
        margin-top: 24px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

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

    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .calculator-card {
        padding: 12px;
    }

    .calculator-title {
        font-size: 14px;
    }

    input[type="number"], input[type="text"] {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 12px;
    }

    .calculate-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .main {
        padding: 12px 0;
    }

    .hero-title {
        font-size: 18px;
    }

    .hero-description {
        font-size: 12px;
    }

    .feature-item {
        padding: 12px 8px;
    }

    .feature-item h3 {
        font-size: 14px;
    }

    .feature-item p {
        font-size: 12px;
    }

    .faq-title {
        font-size: 18px;
    }

    .faq-question {
        font-size: 13px;
        padding: 10px 12px;
    }

    .faq-answer {
        padding: 0 12px;
    }

    .faq-item.active .faq-answer {
        padding: 10px 12px;
    }

    .faq-answer p {
        font-size: 12px;
    }

    .input-group label {
        font-size: 12px;
    }

    .result {
        font-size: 14px;
        padding: 12px;
        margin-top: 6px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo svg, .footer-logo svg {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 30px 0;
    }

    .faq-section {
        padding: 30px 0;
    }

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

/* Print styles */
@media print {
    .header, .footer, .share-btn, .lang-btn, .dropdown {
        display: none;
    }

    .calculator-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .hero-section, .faq-section {
        break-inside: avoid;
    }
}

/* Animation for smooth transitions */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-card {
    animation: fadeInUp 0.6s ease-out;
}

.calculator-card:nth-child(1) { animation-delay: 0.1s; }
.calculator-card:nth-child(2) { animation-delay: 0.2s; }
.calculator-card:nth-child(3) { animation-delay: 0.3s; }
.calculator-card:nth-child(4) { animation-delay: 0.4s; }
.calculator-card:nth-child(5) { animation-delay: 0.5s; }
.calculator-card:nth-child(6) { animation-delay: 0.6s; }

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-green-light) 0%, var(--bg-primary) 100%);
    padding: 40px 0;
    margin-top: 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.hero-content {
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-description {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 50px;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-item {
    background: var(--bg-primary);
    padding: 30px 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-green);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.feature-item h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.feature-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* FAQ Section */
.faq-section {
    padding: 40px 0;
    background: var(--bg-primary);
    margin-top: 24px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

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

.faq-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 40px;
}

.faq-grid {
    display: grid;
    gap: 20px;
}

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

.faq-item:hover {
    border-color: var(--primary-green);
    box-shadow: var(--shadow-sm);
}

.faq-question {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 20px 24px;
    margin: 0;
    cursor: pointer;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.faq-question:hover {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
}

.faq-question::after {
    content: '+';
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    font-weight: 300;
    transition: var(--transition);
}

.faq-item.active .faq-question::after {
    transform: translateY(-50%) rotate(45deg);
}

.faq-answer {
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.faq-item.active .faq-answer {
    max-height: 200px;
    padding: 20px 24px;
}

.faq-answer p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 32px 0 16px;
    margin-top: 32px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: white;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-description {
    color: #9ca3af;
    line-height: 1.6;
    font-size: 14px;
}

.footer-contact {
    color: #9ca3af;
    font-size: 14px;
    margin-top: 12px;
}

.footer-contact a {
    color: var(--primary-green);
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

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

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #374151;
    font-size: 14px;
    color: #9ca3af;
}

.footer-social {
    display: flex;
    gap: 16px;
}

.footer-social a {
    color: #9ca3af;
    transition: var(--transition);
}

.footer-social a:hover {
    color: var(--primary-green);
}
