:root {
    /* Main colors */
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3a1;
    
    /* Base colors */
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #dee2e6;
    --highlight-color: #e9f7ef;
    --error-color: #e74c3c;
    
    /* Theme colors */
    --primary: #4a6fa5;
    --secondary: #166088;
    --background: #f8f9fa;
    --card: #ffffff;
    --text: #333333;
    --background-color: #f8f9fa;
    
    /* Effects */
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --text-shadow: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Prevent horizontal scrolling globally */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Styles - Full Width */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4f46e5;
    text-decoration: none;
    transition: transform 0.3s ease;
    z-index: 1001;
}

.logo:hover {
    transform: scale(1.05);
}

.logo img {
    max-width: 300px;
    height: auto;
    width: 250px;
    border-radius: 8px;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
    white-space: nowrap;
}

.nav-menu a:hover {
    color: #4f46e5;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: linear-gradient(45deg, #4f46e5, #7c3aed);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #374151;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1001;
    position: relative;
}

.mobile-menu-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #4f46e5;
}

.mobile-menu-btn i {
    font-size: 1.2rem;
}

/* Container and Main Content */
.container {
    width: 1200px; /* Fixed width instead of max-width */
    margin: 20px auto;
    padding: 20px;
    border-radius: 10px;
    overflow-x: hidden;
     background: white;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2rem;
}

.description {
    color: #666;
    max-width: 100%;
    margin: 0 auto 20px;
    padding: 0 10px;
}

.converter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.input-section, .output-section {
    flex: 1;
    min-width: 280px;
    width: 100%;
}

.conversion-type {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background-color: var(--background-color);
    border-radius: 30px;
    padding: 5px;
    width: fit-content;
    margin: 0 auto 20px;
    max-width: 100%;
    overflow: hidden;
}

.conversion-type button {
    background-color: transparent;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 14px;
}

.conversion-type button.active {
    background-color: var(--primary-color);
    color: white;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-color);
}

textarea, input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    font-family: monospace;
    box-sizing: border-box;
}

input[type="text"] {
    min-height: auto;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 200px;
}

button:hover {
    background-color: var(--secondary-color);
}

.result-container {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--highlight-color);
    width: 100%;
    box-sizing: border-box;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.result-value {
    font-family: monospace;
    font-size: 18px;
    word-break: break-all;
    margin-bottom: 10px;
    overflow-wrap: break-word;
    width: 100%;
}

.copy-btn {
    background-color: var(--accent-color);
    padding: 5px 10px;
    font-size: 14px;
    min-width: 60px;
    width: auto;
}

.copy-btn:hover {
    background-color: #3da183;
}

.calculation-steps {
    margin-top: 30px;
    width: 100%;
}

.step-by-step {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 20px;
    font-family: monospace;
    white-space: pre-wrap;
    overflow-x: auto;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.settings-panel {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
}

.settings-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
}

.setting-item {
    margin-bottom: 15px;
    width: 100%;
}

.setting-item select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.byte-display {
    margin-top: 30px;
    overflow-x: auto;
    width: 100%;
}

.byte-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-family: monospace;
    width: 100%;
}

.byte {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    text-align: center;
    background-color: white;
    min-width: 60px;
    box-sizing: border-box;
}

.byte .value {
    font-weight: bold;
}

.byte .decimal {
    font-size: 12px;
    color: #666;
}

.error {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 5px;
}

.history-panel {
    margin-top: 30px;
    width: 100%;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    word-break: break-all;
}

.history-item:hover {
    background-color: var(--highlight-color);
}

.history-item:last-child {
    border-bottom: none;
}

.binary-representation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.binary-group {
    font-family: monospace;
    letter-spacing: 2px;
    overflow-wrap: break-word;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.tab-system {
    margin-top: 30px;
    width: 100%;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-track {
    background: transparent;
}

.tabs::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab.active {
    background-color: white;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
    color: var(--primary-color);
    font-weight: 500;
}

.tab-content {
    display: none;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
    width: 100%;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
}

/* Footer */
.site-footer {
    background-color: #f8f9fa;
    padding: 30px 0;
    margin-top: 60px;
    border-top: 1px solid #e9ecef;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #8b5cf6;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #7c3aed;
}

.separator {
    color: #8b5cf6;
    font-size: 14px;
}

.footer-copyright {
    color: #6b7280;
    font-size: 14px;
}

.footer-copyright a {
    color: #8b5cf6;
    text-decoration: none;
}

.footer-copyright a:hover {
    color: #7c3aed;
}

/* Main Info Section */
.main-info {
    width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.main-info h3 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.main-info h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    padding-bottom: 10px;
}

.main-info img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.main-info p {
    margin-bottom: 15px;
    text-align: justify;
    font-size: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* FAQ Section */
.faq-container {
     width: 1200px; /* Fixed width instead of max-width */
    margin: 20px auto;
    padding: 20px;
    border-radius: 10px;
    overflow-x: hidden;
}

.faq-container h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.2em;
    text-align: center;
}

.faq-container h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.3em;
    border-left: 4px solid #3498db;
    padding-left: 15px;
}

.faq-container p {
    margin-bottom: 15px;
    color: #555;
    text-align: justify;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.highlight {
    background: linear-gradient(120deg, #a8e6cf 0%, #dcedc8 100%);
    padding: 2px 4px;
    border-radius: 3px;
}

.code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e74c3c;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .header-content {
        padding: 1rem 15px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo img {
        max-width: 200px;
        width: 200px;
    }

    /* Mobile Navigation */
    .nav-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2rem;
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .nav-menu.active {
        display: flex;
        opacity: 1;
        visibility: visible;
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    .nav-menu a {
        padding: 1rem 2rem;
        font-size: 1.2rem;
        font-weight: 600;
        text-align: center;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        width: 100%;
        display: block;
    }

    .nav-menu a:last-child {
        border-bottom: none;
    }

    .mobile-menu-btn {
        display: block;
        position: relative;
        z-index: 1001;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
    
    .container {
        margin: 10px auto;
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .description {
        font-size: 16px;
        text-align: left;
    }

    .converter-container {
        flex-direction: column;
        gap: 15px;
    }

    .input-section, .output-section {
        min-width: 100%;
        width: 100%;
    }
    
    .conversion-type {
        width: 100%;
        max-width: none;
        margin: 0 0 20px 0;
    }
    
    .conversion-type button {
        font-size: 12px;
        padding: 8px 16px;
    }

    textarea, input[type="text"] {
        font-size: 16px;
        padding: 10px;
        min-height: 80px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .result-value {
        font-size: 16px;
    }

    .settings-content {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .setting-item {
        margin-bottom: 10px;
    }

    .tabs {
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 8px 12px;
        font-size: 14px;
        margin-right: 2px;
        margin-bottom: 5px;
    }

    .tab-content {
        padding: 15px;
    }

    .step-by-step {
        padding: 15px;
        font-size: 14px;
    }

    .byte-grid {
        justify-content: center;
    }

    .byte {
        min-width: 50px;
        padding: 4px 8px;
    }

    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 0 15px;
    }

    .footer-links {
        justify-content: center;
    }

    .main-info {
        padding: 15px;
    }

    .main-info h2, .main-info h3 {
        font-size: 20px;
    }

    .main-info p {
        font-size: 14px;
        text-align: left;
    }

    .faq-container {
        padding: 20px 15px;
        margin: 15px 0;
    }

    .faq-container h2 {
        font-size: 1.8em;
    }

    .faq-container h3 {
        font-size: 1.1em;
    }

    .faq-container p {
        font-size: 14px;
        text-align: left;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header-content {
        padding: 1rem 10px;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .logo img {
        width: 150px;
        max-width: 150px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .conversion-type button {
        font-size: 11px;
        padding: 6px 12px;
    }

    textarea, input[type="text"] {
        padding: 8px;
        font-size: 14px;
    }

    .result-value {
        font-size: 14px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tab-content {
        padding: 10px;
    }

    .step-by-step {
        padding: 10px;
        font-size: 12px;
    }

    .main-info {
        padding: 10px;
    }

    .main-info h2, .main-info h3 {
        font-size: 18px;
    }

    .main-info p {
        font-size: 13px;
    }

    .faq-container {
        padding: 15px 10px;
    }

    .faq-container h2 {
        font-size: 1.6em;
    }

    .faq-container h3 {
        font-size: 1em;
    }

    .faq-container p {
        font-size: 13px;
    }
}

/* Custom scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Ensure all elements respect max-width */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent text overflow */
.container, .main-info, .faq-container, .site-header, .site-footer {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Smooth transitions for better UX */
.site-header, .nav-menu, .mobile-menu-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus styles for accessibility */
.mobile-menu-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-menu a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-menu.active li {
    animation: fadeInUp 0.3s ease forwards;
}

.nav-menu.active li:nth-child(1) { animation-delay: 0.1s; }
.nav-menu.active li:nth-child(2) { animation-delay: 0.2s; }
.nav-menu.active li:nth-child(3) { animation-delay: 0.3s; }
.nav-menu.active li:nth-child(4) { animation-delay: 0.4s; }