* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0F172A;
    --secondary-color: #074d70;
    --bg-color: #FFFFFF;
    --light-bg: #F8FAFC;
    --border-color: #E2E8F0;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --success-color: #10B981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background-color: var(--bg-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 768px) {
    .container {
        width: 90%;
    }
}

@media (min-width: 1024px) {
    .container {
        width: 95%;
        max-width: 1200px;
    }
}

.site-header {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
    border-bottom: 2px solid var(--secondary-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

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

.logo {
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.logo img {
    width: 65px;
    height: 65px;
    margin-right: 16px;
    object-fit: contain;
}

.logo-text {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, #F97316 0%, #F59E0B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.main-nav {
    display: none;
}

@media (min-width: 768px) {
    .main-nav {
        display: block;
    }
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--secondary-color);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    transition: color 0.2s;
}

.nav-dropdown-btn:hover {
    color: var(--secondary-color);
}

.nav-dropdown-btn svg {
    transition: transform 0.2s;
}

.nav-dropdown.active .nav-dropdown-btn svg {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    max-height: 500px;
    overflow: auto;
    list-style: none;
    padding: 8px 0;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

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

.nav-dropdown-menu li {
    padding: 0;
}

.nav-dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-switcher {
    position: relative;
}

.lang-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.lang-button:hover {
    background: var(--border-color);
}

.lang-button .flag {
    font-size: 18px;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    list-style: none;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

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

.lang-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.lang-dropdown a:hover {
    background: var(--light-bg);
}

.lang-dropdown li:first-child a {
    border-radius: 8px 8px 0 0;
}

.lang-dropdown li:last-child a {
    border-radius: 0 0 8px 8px;
}

.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(2, 132, 199, 0.15);
    border: 1px solid rgba(2, 132, 199, 0.3);
    border-radius: 6px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: rgba(2, 132, 199, 0.25);
    border-color: var(--secondary-color);
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: linear-gradient(135deg, #F97316 0%, #F59E0B 100%);
    border-radius: 2px;
    transition: all 0.3s;
}

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

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

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

@media (max-width: 767px) {
    .main-nav {
        position: fixed;
        top: 73px;
        left: 0;
        right: 0;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        transform: translateX(-100%);
        transition: transform 0.3s;
        display: block;
        box-shadow: var(--shadow-lg);
    }
    
    .main-nav.active {
        transform: translateX(0);
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 16px 0;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 16px 24px;
        border-bottom: 1px solid var(--border-color);
    }
    
    /* Mobile Form Layout - Full Width */
    #calculatorForm > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    
    #calculatorForm .btn {
        width: 100% !important;
        margin-bottom: 12px;
    }
    
    #calculatorForm > div[style*="display: flex"] {
        flex-direction: column !important;
    }
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

main {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

.site-footer {
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    padding: 40px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

.footer-section h3 {
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    text-decoration: none;
    color: var(--text-secondary);
    display: block;
    padding: 6px 0;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--secondary-color);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #0369A1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-top: 32px;
}

@media (min-width: 768px) {
    .card {
        padding: 32px;
    }
}

.result-highlight {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0369A1 100%);
    color: white;
    padding: 32px;
    border-radius: 6px;
    text-align: center;
    margin: 32px 0;
    box-shadow: var(--shadow-lg);
}

.result-highlight h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

@media (min-width: 768px) {
    .result-highlight h2 {
        font-size: 42px;
    }
}

.result-highlight p {
    font-size: 18px;
    opacity: 0.95;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 32px 0;
}

@media (min-width: 768px) {
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .result-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.result-item {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #074d7038;
}

.result-item h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.result-item .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.result-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.countdown-timer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.countdown-item {
    text-align: center;
    background: var(--light-bg);
    padding: 20px;
    border-radius: 10px;
}

.countdown-item .number {
    font-size: 32px;
    font-weight: 700;
    color: var(--secondary-color);
    display: block;
}

.countdown-item .label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    background: var(--bg-color);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.education-section {
    margin: 48px 0;
}

.education-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.formula-card {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.formula-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.formula-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.formula-display {
    background: white;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.formula-inline {
    background: rgba(2, 132, 199, 0.1);
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 0;
    border: 1px solid #074d702b !important;
}

.example-box {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 10px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.example-box h4 {
    color: var(--secondary-color);
    margin-bottom: 12px;
    font-size: 16px;
}

.faq-container {
    margin: 32px 0;
}

.faq-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 16px;
}

.faq-item h3 {
    color: var(--secondary-color);
    font-size: 18px;
    margin-bottom: 12px;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.formula-step {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid var(--border-color);
}

.formula-step strong {
    color: var(--secondary-color);
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media print {
    .site-header,
    .site-footer,
    .action-buttons,
    .mobile-menu-toggle {
        display: none;
    }
    
    body {
        background: white;
    }
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    * {
        max-width: 100%;
    }
    
    .katex-display {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0;
        font-size: 0.9em !important;
    }
    
    .katex {
        font-size: 0.9em !important;
    }
    
    .katex-display > .katex {
        white-space: normal;
        text-align: left;
    }
    
    .formula-display {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0;
        max-width: 100%;
    }
    
    .formula-inline {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .card {
        overflow-x: hidden;
    }
    
    .result-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .value {
        font-size: 22px !important;
        word-wrap: break-word;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 30px 0 20px 0 !important;
    }
    
    .footer-logo a {
        justify-content: center;
    }
    
    .footer-links {
        text-align: center !important;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .footer-links a {
        display: block;
        margin: 0 !important;
    }
    
    .footer-links span {
        display: none;
    }
    
    .nav-menu a {
        color: #182235 !important;
    }
    
    .nav-dropdown-btn {
        color: #182235 !important;
    }
}

@media (max-width: 480px) {
    .katex-display {
        font-size: 0.8em !important;
    }
    
    .katex {
        font-size: 0.8em !important;
    }
    
    .value {
        font-size: 18px !important;
    }
    
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 16px !important;
    }
}

/* Print Styles - Only Results Section */
@media print {
    /* Hide everything except results */
    .site-header,
    .site-footer,
    .mobile-menu-toggle,
    .mobile-overlay,
    .education-section,
    .faq-section,
    .countdown-timer,
    #shareSection,
    #calculatorForm,
    .no-print {
        display: none !important;
    }
    
    /* Show only result cards */
    body {
        background: white;
        margin: 20px;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    main {
        padding: 0;
    }
    
    /* Keep website colors in print */
    h1 {
        color: var(--primary-color) !important;
        font-size: 28px !important;
        margin-bottom: 24px;
        page-break-after: avoid;
    }
    
    .result-highlight {
        background: linear-gradient(135deg, rgba(2, 132, 199, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%) !important;
        border: 2px solid var(--secondary-color) !important;
        page-break-inside: avoid;
        margin-bottom: 24px;
        padding: 24px;
        border-radius: 12px;
    }
    
    .result-highlight h2 {
        color: var(--secondary-color) !important;
        font-size: 32px !important;
    }
    
    .result-highlight p {
        color: var(--text-secondary) !important;
    }
    
    .card {
        page-break-inside: avoid;
        border: 1px solid var(--border-color) !important;
        background: white !important;
        margin-bottom: 24px;
        box-shadow: none !important;
    }
    
    .result-grid {
        page-break-inside: avoid;
    }
    
    .result-item {
        page-break-inside: avoid;
        border: 1px solid var(--border-color) !important;
        background: var(--light-bg) !important;
    }
    
    .result-item h3 {
        color: var(--text-primary) !important;
        font-size: 14px !important;
    }
    
    .result-item .value {
        color: var(--secondary-color) !important;
        font-size: 22px !important;
        font-weight: 700 !important;
    }
    
    .result-item p {
        color: var(--text-secondary) !important;
        font-size: 13px !important;
    }
    
    /* Keep section headings colored */
    h2 {
        color: var(--primary-color) !important;
        font-size: 24px !important;
        page-break-after: avoid;
    }
    
    /* Ensure colors are preserved */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}
