/* Base Styles */
body { 
    background: #222; 
    color: #fff; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0; 
    padding: 20px; 
    line-height: 1.6;
}

.title { 
    text-align: center; 
    font-size: 28px; 
    font-weight: bold; 
    color: #fe7e00; 
    margin: 24px 0 20px; 
}

.stats { 
    text-align: center; 
    margin: 10px 0 20px; 
    color: #bbb; 
    font-size: 14px; 
}

.stats span { margin: 0 15px; }
.stats .number { color: #fe7e00; font-weight: bold; }

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

.mainbox { 
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px; 
    margin-bottom: 20px;
}

.fullwidth-section {
    display: block;
    width: 100%;
    margin-bottom: 20px;
}

.card { 
    background: #262626; 
    padding: 18px 22px; 
    border-radius: 10px; 
    box-shadow: 0 2px 10px #111; 
}

.card h2 { 
    color: #fe7e00; 
    font-size: 20px; 
    margin-bottom: 10px; 
    margin-top: 0; 
}

/* Info Section */
.label { font-weight: bold; color: #fff; }
.value { color: #fff; }
a.ip-link { color: #eaff43; text-decoration: none; font-weight: bold; }
a.ip-link:hover { text-decoration: underline; }
.flag { font-size: 19px; margin-right: 4px; }
.header-row { font-size: 13px; margin-top: 3px; word-break: break-all; }
small { color: #bbb; font-size: 12px; }
.info-line { margin: 8px 0; }

/* Speedtest Section - Redesigned */
.speedtest-section {
    margin-bottom: 20px;
}

.speedtest-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 100%);
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
}

.speedtest-gauge-circular {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 0 auto 30px;
}

.gauge-circular-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(254, 126, 0, 0.2));
}

.speed-value-large {
    font-size: 32px;
    font-weight: 700;
    fill: #fe7e00;
    letter-spacing: -2px;
}

.speed-unit-text {
    font-size: 14px;
    fill: #888;
    font-weight: 500;
}

.gauge-tick {
    stroke-linecap: round;
    transition: stroke 0.15s ease-out;
}

.gauge-tick.active {
    filter: drop-shadow(0 0 3px currentColor);
}


/* Speed Metrics Grid */
.speed-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.metric-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.metric-box:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(254, 126, 0, 0.3);
    transform: translateY(-2px);
}

.metric-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(254, 126, 0, 0.1);
    border-radius: 50%;
    flex-shrink: 0;
}

.metric-content {
    flex: 1;
    text-align: left;
}

.metric-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value-big {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    line-height: 1;
}

.metric-value-big.download {
    color: #7cb342;
}

.metric-value-big.upload {
    color: #42a5f5;
}

.metric-value-big.latency {
    color: #ffb300;
}

.metric-unit-small {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Rating Display - Redesigned */
.speedtest-rating-new {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(124, 179, 66, 0.1);
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(124, 179, 66, 0.3);
}

.rating-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.rating-score {
    font-size: 36px;
    font-weight: bold;
    color: #7cb342;
    line-height: 1;
}

.rating-stars-display {
    color: #7cb342;
    font-size: 20px;
    letter-spacing: 2px;
}

.rating-text-display {
    font-size: 18px;
    color: #7cb342;
    font-weight: 600;
}

/* Button - Redesigned */
.speedtest-btn-new {
    background: linear-gradient(135deg, #fe7e00 0%, #ff9520 100%);
    color: #fff;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(254, 126, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.speedtest-btn-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 30px rgba(254, 126, 0, 0.5);
    background: linear-gradient(135deg, #ff9520 0%, #fe7e00 100%);
}

.speedtest-btn-new:active {
    transform: translateY(-1px);
}

.speedtest-btn-new:disabled {
    background: linear-gradient(135deg, #555 0%, #666 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.speedtest-status {
    margin-top: 20px;
    color: #bbb;
    font-size: 14px;
    min-height: 20px;
    font-weight: 500;
}

/* Port Scanner Styles */
.port-scanner { 
    background: #2d2d2d; 
    padding: 20px; 
    border-radius: 8px; 
    margin-top: 10px; 
}

.port-scanner h3 { 
    color: #eaff43; 
    margin: 0 0 15px 0; 
    font-size: 16px; 
}

.port-form { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.port-input-group { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}

.port-input-group label { 
    min-width: 50px; 
    color: #bbb; 
    font-size: 14px; 
}

.port-input-group input { 
    flex: 1; 
    padding: 8px 12px; 
    background: #1a1a1a; 
    border: 1px solid #444; 
    border-radius: 5px; 
    color: #fff; 
    font-size: 14px; 
}

.port-input-group input:focus { 
    outline: none; 
    border-color: #fe7e00; 
}

.port-btn { 
    background: #fe7e00; 
    color: #fff; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 14px; 
    transition: background 0.2s;
}

.port-btn:hover { background: #ff9520; }
.port-btn:disabled { background: #555; cursor: not-allowed; }

.port-result { 
    margin-top: 15px; 
    padding: 12px; 
    background: #1a1a1a; 
    border-radius: 5px; 
    border-left: 4px solid #fe7e00; 
}

.port-result.success { border-left-color: #4caf50; }
.port-result.error  { border-left-color: #f44336; }
.port-result-text   { margin: 0; font-size: 13px; }
.port-info          { color: #bbb; font-size: 12px; margin-top: 10px; }

.common-ports       { margin-top: 10px; }
.common-ports-title { color: #bbb; font-size: 13px; margin-bottom: 5px; }
.port-tags          { display: flex; flex-wrap: wrap; gap: 6px; }

.port-tag { 
    background: #3a3a3a; 
    color: #eaff43; 
    padding: 4px 10px; 
    border-radius: 3px; 
    font-size: 12px; 
    cursor: pointer; 
    border: 1px solid #555; 
    transition: all 0.2s;
}

.port-tag:hover { 
    background: #4a4a4a; 
    border-color: #fe7e00; 
}

/* NMAP Section */
.nmap-section { 
    margin-top: 15px; 
    padding-top: 15px; 
    border-top: 1px solid #444; 
}

.nmap-login { 
    background: #2d2d2d; 
    padding: 15px; 
    border-radius: 5px; 
}

.nmap-login input { 
    width: 100%; 
    padding: 8px; 
    background: #1a1a1a; 
    border: 1px solid #444; 
    border-radius: 5px; 
    color: #fff; 
    margin-bottom: 10px; 
    box-sizing: border-box;
}

.nmap-scanner { display: none; }
.nmap-scanner.active { display: block; }

.nmap-args { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 10px; 
}

.nmap-arg { 
    background: #3a3a3a; 
    color: #fff; 
    padding: 5px 12px; 
    border-radius: 3px; 
    font-size: 12px; 
    cursor: pointer; 
    border: 1px solid #555; 
    transition: all 0.2s;
}

.nmap-arg:hover {
    background: #4a4a4a;
}

.nmap-arg.active { 
    background: #fe7e00; 
    border-color: #fe7e00; 
}

.nmap-arg.nmap-preset {
    background: #004d99;
    border-color: #007bff;
    color: #eaffff;
}

.nmap-arg.nmap-preset.active {
    background: #007bff;
}

.nmap-output { 
    margin-top: 15px; 
    padding: 15px; 
    background: #1a1a1a; 
    border-radius: 5px; 
    max-height: 400px; 
    overflow-y: auto; 
    font-family: 'Courier New', monospace; 
    font-size: 12px; 
    white-space: pre-wrap; 
    word-wrap: break-word; 
}

.logout-btn { 
    background: #f44336; 
    color: #fff; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 3px; 
    cursor: pointer; 
    font-size: 12px; 
    margin-top: 10px; 
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #d32f2f;
}

/* Map Styles */
#ip-map {
    margin-top: 12px;
    width: 100%;
    height: 320px;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    border: 1px solid #444;
}

#ip-map.leaflet-container {
    background: #111;
}

/* Footer */
.footer { 
    text-align: center; 
    margin: 18px 0; 
    color: #bbb; 
}

.footer a { 
    color: #66eeff; 
    text-decoration: none; 
    margin: 0 8px;
}

.footer a:hover { 
    text-decoration: underline; 
    color: #fe7e00;
}

.copyright { 
    text-align: center; 
    margin: 20px auto 0; 
    padding-top: 15px; 
    border-top: 1px solid #444; 
    color: #999; 
    font-size: 13px; 
    max-width: 1200px; 
}

/* Responsive */
@media (max-width: 1024px) {
    .mainbox { 
        grid-template-columns: 1fr; 
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .title {
        font-size: 22px;
    }

    .stats {
        font-size: 12px;
    }

    .stats span {
        margin: 0 8px;
        display: inline-block;
    }

    .speedtest-container {
        padding: 25px 15px;
    }

    .speedtest-gauge-circular {
        max-width: 350px;
    }
    
    .speed-value-large {
        font-size: 56px;
    }

    .speed-metrics-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .metric-value-big {
        font-size: 28px;
    }
    
    .speedtest-rating-new {
        flex-direction: column;
        gap: 15px;
    }

    .rating-score {
        font-size: 28px;
    }

    .rating-text-display {
        font-size: 16px;
    }

    .speedtest-btn-new {
        padding: 14px 36px;
        font-size: 14px;
    }

    .card {
        padding: 15px 18px;
    }

    .card h2 {
        font-size: 18px;
    }

    .port-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .port-input-group label {
        min-width: auto;
    }

    #ip-map {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 20px;
    }

    .stats span {
        display: block;
        margin: 5px 0;
    }

    .speedtest-gauge-circular {
        max-width: 300px;
    }

    .speed-value-large {
        font-size: 48px;
    }

    .metric-icon {
        font-size: 24px;
        width: 40px;
        height: 40px;
    }

    .metric-value-big {
        font-size: 24px;
    }

    .footer {
        font-size: 12px;
    }

    .footer a {
        display: block;
        margin: 8px 0;
    }
}
