/* :root {
    --primary-blue: #1e3a8a;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1e40af;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --text-light-gray: #9ca3af;
    --border-gray: #e5e7eb;
    --bg-light: #f9fafb;
    --bg-active: #dcebfa;
} */

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

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: white;
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    /* fills remaining space */
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-gray);
    padding: 0.2rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-blue) !important;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    color: var(--primary-blue);
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.navbar-nav .nav-link {
    color: var(--text-dark) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0 8px;
    padding: 8px 16px !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link:hover {
    /* background: var(--bg-light); */
    background: var(--bg-active);
    color: var(--primary-blue) !important;
}

.navbar-nav .nav-link.active {
    /* background: var(--bg-light); */
    background: var(--bg-active);
    color: var(--primary-blue) !important;
}

.navbar-nav .nav-link i {
    margin-right: 0.5rem;
}

/* Navbar Toggle Button */
.navbar-toggler {
    border: 1px solid var(--border-gray) !important;
    background-color: transparent !important;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    outline: none !important;
}

.navbar-toggler-icon {
    filter: brightness(var(--icon-brightness, 0)) invert(var(--icon-invert, 1));
}

.navbar-toggler:focus {
    border: 1px solid var(--primary-blue) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
    outline: none !important;
}

.navbar-toggler:hover {
    border: 1px solid var(--primary-blue) !important;
}

.navbar-toggler:active {
    border: 1px solid var(--primary-blue) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3) !important;
}



/* Main Container */
.main-container {
    max-width: 1000px;
    margin: 4rem auto;
    padding: 0 1rem;
}

.speedtest-card {
    /* background: white; */
    /* background: var(--bg-light); */
    border-radius: 0;
    padding: 2rem 1rem;
    text-align: center;
}

.speedtest-title {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.speedtest-subtitle {
    color: var(--text-gray);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Speed Display - Big Numbers like fast.com */
.speed-display {
    margin: 2rem auto;
    text-align: center;
}

.speed-value {
    font-size: 10rem;
    font-weight: 400;
    color: var(--text-dark);
    margin-bottom: 0;
    font-feature-settings: 'tnum';
    line-height: 1;
}

.speed-unit {
    font-size: 2rem;
    color: var(--text-gray);
    font-weight: 300;
    margin-left: 1rem;
    display: inline;
}

.speed-status {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-top: 1rem;
    font-weight: 400;
}

.speed-progress {
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: var(--border-gray);
    border-radius: 2px;
    margin: 2rem auto;
    overflow: hidden;
}

.speed-progress-bar {
    height: 100%;
    background: var(--primary-blue);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Test Button */
.test-button {
    background: var(--primary-blue);
    border: none;
    padding: 18px 48px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 3rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 50px;
}

.test-button:hover:not(:disabled) {
    background: var(--dark-blue);
    transform: translateY(-1px);
}

.test-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results Section - Big Numbers */
.results-section {
    /* margin: 4rem 0; */
    display: none;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin: 0 0 2rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.results-section .result-item {
    border: 1px solid var(--border-gray);
    border-radius: 10px;
}

.result-item {
    text-align: center;
    padding: 2rem 1rem;
}

.result-value {
    font-size: 4rem;
    font-weight: 300;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-feature-settings: 'tnum';
    line-height: 1;
}

.result-unit {
    font-size: 1.2rem;
    color: var(--text-gray);
    font-weight: 300;
    margin-left: 0.5rem;
    display: block;
}

.result-label {
    color: var(--text-gray);
    font-weight: 500;
    font-size: 1rem;
    margin-top: 0.5rem;
    text-transform: capitalize;

    /* letter-spacing: 1px;*/
}

/* Action Buttons */
.action-section {
    margin: 2rem 0;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-action {
    background: var(--bg-page);
    border: 1px solid var(--border-gray);
    color: var(--text-dark);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-action:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

/* Toast Notifications */
/* .toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1050;
    max-width: 350px;
}

.toast {
    background: white;
    border: 1px solid var(--border-gray);
    color: var(--text-dark);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toast-success {
    border-left: 4px solid var(--accent-green);
}

.toast-error {
    border-left: 4px solid var(--accent-red);
}

.toast-warning {
    border-left: 4px solid var(--accent-orange);
}

.toast-info {
    border-left: 4px solid var(--primary-blue);
} */

/* Toast Container and Styling */
/* .toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1050;
    max-width: 350px;
}

.toast {
    background: var(--bg-white) !important;
    border: 1px solid var(--border-gray) !important;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-lg) !important;
    margin-bottom: 10px;
    opacity: 1;
    animation: slideInRight 0.3s ease forwards;
}

.toast-body {
    padding: 12px;
    color: var(--text-dark) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-gray);
    margin-left: auto;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
} */

/* Modal Styles */
.modal-content {
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid var(--border-gray);
    background: var(--bg-light);
}

.modal-footer {
    border-top: 1px solid var(--border-gray);
}

.table {
    color: var(--text-dark);
}

.table th {
    background: var(--bg-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-gray);
}

.table td {
    border-bottom: 1px solid var(--border-gray);
    padding: 1rem 0.75rem;
}

.table-hover tbody tr:hover {
    background: var(--bg-light);
}

.table tr {
    border-color: var(--table-border);
}

/* Footer */
.footer {
    /* position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 999; */
    margin-top: 2rem;
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid var(--border-gray);
    background: var(--bg-white);
}

.footer p {
    color: var(--text-gray);
    margin: 0;
    font-size: 0.9rem;
}

.current-results {
    display: block;
    margin: 0 6rem;
    border: 1px solid #f2f2f2;
    border-radius: 15px;
    box-shadow: 5px 5px 5px 0px rgba(0, 0, 0, 0.1);
}

.current-results-grid {
    display: flex;
    justify-content: space-evenly;
}

.current-result-item {
    padding: 1rem;
}

.current-result-label {
    color: var(--text-gray);
}

span#currentDownload,
span#currentUpload,
span#currentPing,
span#currentQuality,
span.current-result-unit {
    font-weight: 600;
}

/* Default: Hide both */
#currentResults,
#resultsSection {
    display: none;
}

p.user_ip {
    color: var(--text-gray);
}

.speedtest_history_table,
.grid-view .summary {
    font-size: 12px;
}

.speedtest_history_table thead tr th {
    background-color: var(--bg-table-header);
}

.speedtest_history_table thead th,
.speedtest_history_table thead th a {
    text-transform: capitalize !important;
    color: white;
    text-decoration: none;
}

.nav_settings .bi {
    margin-right: 0 !important;
}

.table>:not(caption):not(thead)>*>* {
    background-color: var(--border-gray) !important;
}

.table>:not(caption):not(thead)>*>* {
    color: var(--text-dark) !important;
}

.form-control,
.daterangepicker,
.daterangepicker .calendar-table,
.page-link {
    background: var(--bg-page) !important;
    color: var(--text-dark) !important;
}

.form-control::placeholder {
    color: var(--text-dark) !important;
}

.daterangepicker td.off {
    background-color: transparent !important;
}

.daterangepicker .btn {
    color: var(--text-dark) !important;
}

.daterangepicker .btn:hover {
    color: var(--text-gray) !important;
}

.text-muted {
    color: var(--text-gray);
}

.servers-container p {
    color: var(--text-gray);
    font-size: 0.8rem;
}

.servers-container ul {
    --bs-dropdown-link-color: var(--text-dark);
    --bs-dropdown-link-hover-color: var(--text-dark);
    --bs-dropdown-link-hover-bg: var(--dropdown-link-hover);
    background-color: var(--bg-login);
}

.server-item {
    margin-right: 5px;
    margin-bottom: 10px;
}

.users_table td a {
    color: var(--grid-buttons) !important;
}

.link-go-home {
    color: var(--text-dark);
    text-decoration: none;
}

/* Large screens: show currentResults */
@media (min-width: 992px) {
    #currentResults {
        display: block !important;
    }

    #resultsSection {
        display: none !important;
    }
}

/* Mobile + Tablet: show resultsSection */
@media (max-width: 991px) {
    #resultsSection {
        display: block !important;
    }

    #currentResults {
        display: none !important;
    }
}



/* Responsive Design */
@media (max-width: 768px) {
    .speedtest-card {
        padding: 2rem 1rem;
    }

    .speedtest-title {
        font-size: 2rem;
    }

    .speed-value {
        font-size: 6rem;
    }

    .speed-unit {
        font-size: 1.5rem;
    }

    .result-value {
        font-size: 3rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .current-results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn-action {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .main-container {
        padding: 0 0.5rem;
    }

    .speedtest-card {
        padding: 1.5rem 0.5rem;
    }

    .speed-value {
        font-size: 4.5rem;
    }

    .speed-unit {
        font-size: 1.2rem;
    }

    .speedtest-title {
        font-size: 1.8rem;
    }

    .test-button {
        padding: 14px 32px;
        font-size: 1rem;
        margin: 1.5rem;
    }

    .result-value {
        /* font-size: 2.5rem; */
        font-size: 2rem;
        font-weight: 400;
    }

    .results-grid,
    .results-section {
        margin: 2rem 0;
    }

    .result-item {
        /* box-shadow: rgba(0, 0, 0, 0.1) 5px 5px 5px 0px; */
        /* border-radius: 15px; */
        margin-bottom: 15px;
    }

    .connection_alias_form .form-label {
        text-align: left;
    }
}

/* Loading States */
.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Dropdown Menu Styles */
.dropdown-menu {
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
    color: var(--text-dark);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

/* Status Indicators */
.status-excellent {
    color: var(--accent-green);
}

.status-good {
    color: var(--primary-blue);
}

.status-fair {
    color: var(--accent-orange);
}

.status-poor {
    color: var(--accent-red);
}

/* Testing Animation */
.testing-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}