* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0b131e;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* تنظیم جهت صفحه بر اساس زبان انتخاب شده در HTML */
html[lang="fa"] body, 
html[lang="ps"] body, 
html[lang="ar"] body {
    direction: rtl;
    text-align: right;
}

html[lang="en"] body,
html[lang]:not([lang="fa"]):not([lang="ps"]):not([lang="ar"]) body {
    direction: ltr;
    text-align: left;
}

.container {
    background-color: #121c2c;
    width: 100%;
    max-width: 750px;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    gap: 5px;
}

html[lang="fa"] header, 
html[lang="ps"] header, 
html[lang="ar"] header {
    flex-direction: row-reverse;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

select {
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 12px;
}

select:hover {
    border-color: #38bdf8;
}

.ip-info {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 25px;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 10px;
    text-align: center;
}

.speed-ometer {
    text-align: center;
    margin-bottom: 30px;
}

.circle-progress {
    background: radial-gradient(circle, #1e293b 0%, #121c2c 80%);
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 4px solid #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.circle-progress h1 {
    font-size: 42px;
    font-weight: bold;
    color: #ffffff;
}

.circle-progress .unit {
    font-size: 14px;
    color: #94a3b8;
}

.circle-progress p {
    font-size: 13px;
    color: #38bdf8;
    margin-top: 5px;
    font-weight: 600;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.metric-card {
    background-color: #1e293b;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #334155;
}

.icon-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 8px;
}

html[lang="fa"] .icon-title, 
html[lang="ps"] .icon-title, 
html[lang="ar"] .icon-title {
    flex-direction: row-reverse;
}

.metric-card h2 {
    font-size: 18px;
    color: #ffffff;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.action-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.action-buttons button:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: #10b981;
    color: #ffffff;
}

.btn-save {
    background-color: #0284c7;
    color: #ffffff;
}

.btn-secondary {
    background-color: #334155;
    color: #ffffff;
}

.suitability-box {
    background-color: #1e293b;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 4px solid #38bdf8;
}

html[lang="fa"] .suitability-box,
html[lang="ps"] .suitability-box,
html[lang="ar"] .suitability-box {
    border-left: none;
    border-right: 4px solid #38bdf8;
}

.suitability-box h4 {
    font-size: 14px;
    color: #38bdf8;
    margin-bottom: 5px;
}

.suitability-box p {
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
}

.history-section {
    background-color: #1e293b;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

html[lang="fa"] .history-header,
html[lang="ps"] .history-header,
html[lang="ar"] .history-header {
    flex-direction: row-reverse;
}

.history-header h3 {
    font-size: 14px;
    color: #ffffff;
}

.btn-clear {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

#historyList {
    list-style: none;
    max-height: 100px;
    overflow-y: auto;
}

#historyList li {
    background-color: #0f172a;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    color: #94a3b8;
    direction: ltr; /* جهت خوانایی دقیق اعداد و ساعت در تاریخچه */
}

.report-footer {
    text-align: center;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #1e293b;
    padding-top: 15px;
}

.report-footer a {
    color: #38bdf8;
    text-decoration: none;
}

.report-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    header {
        flex-wrap: wrap !important;
        gap: 5px;
    }
    .logo {
        font-size: 16px !important;
    }
    .controls {
        gap: 4px;
    }
    .controls select, .controls button {
        font-size: 11px !important;
        padding: 5px 8px !important;
    }
}

/* حالت ریسپانسیو برای موبایل */
@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .action-buttons {
        flex-direction: column;
    }
}
/* استایل‌های واکنش‌گرا برای موبایل */
@media screen and (max-width: 768px) {
    .container {
        width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box;
    }
    
    .controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .controls select {
        width: 100% !important;
        margin-bottom: 5px;
    }

    /* کوچک کردن دایره سرعت برای صفحه موبایل */
    #speedDisplay, .speed-gauge {
        max-width: 250px;
        margin: 0 auto;
    }
    .controls select, .controls button{
        font-size: 12px;
        padding: 6px 10px;
    }
    header{
        flex-wrap: wrap;
    }
    .logo{
        margin-bottom: 10px;
    }
}