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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
#headerout {
    background-color: #2b7ddb;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#header {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

#logo a {
    color: white;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
}

#login a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid white;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#login a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Content Layout */
#contentout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

#content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Breadcrumbs */
#breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

#breadcrumbs a {
    color: #2b7ddb;
    text-decoration: none;
}

#breadcrumbs a:hover {
    text-decoration: underline;
}

/* Print Button */
#printit {
    float: right;
    margin-bottom: 20px;
}

#printit a {
    color: #2b7ddb;
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid #2b7ddb;
    border-radius: 4px;
}

/* Headings */
h1 {
    color: #2b7ddb;
    font-size: 32px;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    color: #333;
    font-size: 24px;
    margin: 20px 0 15px 0;
}

h3 {
    color: #333;
    font-size: 20px;
    margin: 15px 0 10px 0;
}

h4 {
    color: #333;
    font-size: 16px;
    margin: 10px 0 5px 0;
    font-weight: bold;
}

/* Calculator Layout */
.leftinput {
    float: left;
    width: 60%;
    padding-right: 20px;
}

.rightresult {
    float: right;
    width: 40%;
    padding-left: 20px;
}

/* Calculator Styles */
.calculator-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.calculator {
    background-color: #333;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 100%;
}

.display {
    margin-bottom: 20px;
}

.display input {
    width: 100%;
    height: 60px;
    font-size: 24px;
    text-align: right;
    padding: 0 15px;
    border: none;
    border-radius: 5px;
    background-color: #000;
    color: white;
    outline: none;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.btn {
    height: 60px;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn:hover {
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

.btn.number {
    background-color: #666;
    color: white;
}

.btn.number:hover {
    background-color: #777;
}

.btn.operator {
    background-color: #ff9500;
    color: white;
}

.btn.operator:hover {
    background-color: #ffad33;
}

.btn.clear {
    background-color: #a6a6a6;
    color: black;
}

.btn.clear:hover {
    background-color: #b8b8b8;
}

.btn.equals {
    background-color: #ff9500;
    color: white;
    grid-column: span 2;
}

.btn.equals:hover {
    background-color: #ffad33;
}

.btn.zero {
    grid-column: span 2;
}

/* Result Section */
.result-section {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.h2result {
    color: #2b7ddb;
    font-size: 20px;
    margin-bottom: 15px;
}

.history-container {
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.history-item {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    font-family: monospace;
}

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

/* Features Section */
.features-section {
    background-color: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.features-section ul {
    list-style-type: none;
    padding-left: 0;
}

.features-section li {
    padding: 5px 0;
    position: relative;
    padding-left: 20px;
}

.features-section li:before {
    content: "✓";
    color: #2b7ddb;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Guide Section */
.guide-section {
    margin: 20px 0;
}

.guide-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.guide-section li {
    margin: 5px 0;
}

/* Related Tools */
.related-tools {
    margin: 30px 0;
}

.related-tools table {
    width: 100%;
    border-collapse: collapse;
}

.related-tools td {
    padding: 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}

.related-tools a {
    color: #2b7ddb;
    text-decoration: none;
    font-weight: bold;
}

.related-tools a:hover {
    text-decoration: underline;
}

/* FAQ Section */
.faq-section {
    margin: 30px 0;
}

.faq-section h4 {
    color: #2b7ddb;
    margin-top: 20px;
}

.faq-section p {
    margin: 10px 0;
    text-align: justify;
}

/* Tips Section */
.tips-section {
    background-color: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

.tips-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.tips-section li {
    margin: 8px 0;
}

/* SEO Content */
.seo-content {
    margin: 30px 0;
}

.seo-content p {
    margin: 15px 0;
    text-align: justify;
}

.seo-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.seo-content li {
    margin: 5px 0;
}

/* Utility Classes */
#clear {
    clear: both;
}

.espaceforM {
    height: 20px;
}

#insmdc {
    text-align: center;
    margin: 20px 0;
}

/* Strong text highlighting */
strong {
    color: #2b7ddb;
    font-weight: bold;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    #header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    #contentout {
        padding: 10px;
    }

    #content {
        padding: 15px;
    }

    .leftinput, .rightresult {
        float: none;
        width: 100%;
        padding: 0;
    }

    .rightresult {
        margin-top: 30px;
    }

    h1 {
        font-size: 24px;
    }

    .calculator {
        padding: 15px;
        max-width: 100%;
    }

    .display input {
        height: 50px;
        font-size: 20px;
    }

    .btn {
        height: 50px;
        font-size: 16px;
    }

    .related-tools table {
        font-size: 14px;
    }

    .related-tools td {
        padding: 8px;
    }
}

@media screen and (max-width: 480px) {
    .calculator {
        padding: 10px;
    }

    .display input {
        height: 45px;
        font-size: 18px;
    }

    .btn {
        height: 45px;
        font-size: 14px;
    }

    .buttons {
        gap: 8px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }
}

/* Print Styles */
@media print {
    #headerout, #printit, .related-tools, .faq-section, .tips-section {
        display: none;
    }

    body {
        background-color: white;
    }

    #content {
        box-shadow: none;
        padding: 0;
    }

    .calculator {
        background-color: white;
        border: 2px solid #333;
    }

    .btn {
        border: 1px solid #333;
    }
}

/* Accessibility */
.btn:focus {
    outline: 2px solid #2b7ddb;
    outline-offset: 2px;
}

.display input:focus {
    outline: 2px solid #2b7ddb;
}

/* Animation for button press */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn.pressed {
    animation: buttonPress 0.1s ease-in-out;
}

/* Loading animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error state */
.error {
    background-color: #ff4444 !important;
    color: white !important;
}

/* Success state */
.success {
    background-color: #44ff44 !important;
    color: black !important;
}

/* Related Tools Section */
.related-tools {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.related-tools h3 {
    color: #2b7ddb;
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.tool-item {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2b7ddb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tool-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tool-item h4 {
    margin-bottom: 10px;
}

.tool-item h4 a {
    color: #2b7ddb;
    text-decoration: none;
    font-size: 18px;
}

.tool-item h4 a:hover {
    text-decoration: underline;
}

.tool-item p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}
