:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --dark: #1a1a2e;
    --darker: #0f0f1e;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
}

.logo a {
    font-size: 24px;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none;
    background: none;
    -webkit-text-fill-color: #fff;
}


.nav {
    display: flex;
    gap: 30px;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover,
.nav a.active {
    color: var(--primary);
}

.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 16px;
    border: 2px solid var(--border);
    transition: border-color 0.3s;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
}

/* --- Search Section Compact --- */
.search-section {
    padding: 20px 0;
    background: transparent;
    position: relative;
    z-index: 100;
}

.search-container {
    background: rgba(30, 30, 40, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    /* Reduced width */
    margin: 0 auto;
}

.search-row {
    display: flex;
    flex-direction: column;
    /* Changed from row to column */
    gap: 15px;
    align-items: stretch;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: #a0a0a0;
    z-index: 2;
}

#addressInput {
    width: 100%;
    padding: 15px 15px 15px 45px;
    /* Increased padding */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

#addressInput:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* --- Compact Filters --- */
.filters-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    /* Allow wrapping */
}

.filter-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    padding: 12px 30px 12px 15px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 140px;
    flex: 1;
    /* Distribute space evenly */
}

.filter-select:focus {
    border-color: #667eea;
    outline: none;
}

/* --- Autocomplete Dropdown --- */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e28;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    /* Ensure left/right alignment */
    align-items: center;
    gap: 15px;
    transition: background 0.2s;
}

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

.autocomplete-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.item-address {
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
    /* Explicitly align left */
}

.item-providers {
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    /* Explicitly align right */
}

.search-loader {
    padding: 15px;
    text-align: center;
    color: #888;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Tariff Cards (Dark Theme) --- */
.tariffs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.provider-block {
    margin-bottom: 30px;
    background: rgba(30, 30, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.provider-block-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.provider-block-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.tariff-card {
    background: rgba(255, 255, 255, 0.03);
    /* Dark transparent bg */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 280px 1fr 1fr 1fr 200px;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, background 0.2s;
    position: relative;
}

.tariff-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
}

/* Column 1: Info */
.tariff-main-info {
    display: flex;
    align-items: flex-start;
    gap: 0;
    /* Removed gap since logo is gone */
}

.provider-logo-wrap {
    display: none;
    /* Hide logo */
}

.provider-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tariff-names {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tariff-title {
    font-size: 14px;
    font-weight: 500;
    color: #a0a0a0;
    /* Muted color */
}

.provider-name {
    font-size: 18px;
    /* Larger font */
    color: #fff;
    /* White color */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tariff-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(102, 126, 234, 0.15);
    color: #a0a0ff;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

/* Middle Columns: Specs */
.tariff-specs-row {
    display: contents;
}

.tariff-spec {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spec-label {
    font-size: 12px;
    color: #888;
}

.spec-value {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    /* White text */
}

.spec-sub {
    font-size: 13px;
    color: #aaa;
}

/* Right Column: Action */
.tariff-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.btn-connect {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

.btn-connect:hover {
    opacity: 0.9;
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.5);
}

.btn-toggle-tariffs {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-toggle-tariffs:hover {
    color: #fff;
}

.hidden-tariffs .tariff-card {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.03);
    margin-bottom: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-inline {
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .tariff-card {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 20px;
    }

    .tariff-main-info {
        grid-column: 1 / -1;
    }

    .tariff-action {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .btn-connect {
        width: auto;
        min-width: 150px;
    }
}

@media (max-width: 576px) {
    .tariff-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 15px;
    }

    .tariff-action {
        width: 100%;
        flex-direction: column-reverse;
    }

    .btn-connect {
        width: 100%;
    }

    /* Hide SPEEDTEST NET text on mobile */
    .logo span {
        display: none;
    }

    /* Fix autocomplete items on mobile */
    .autocomplete-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 15px;
    }

    .item-address {
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
        font-size: 13px;
    }

    .item-providers {
        max-width: 100%;
        text-align: left;
        font-size: 11px;
        color: #666;
    }

    /* Tariff card mobile layout */
    .tariff-main-info {
        width: 100%;
        justify-content: center;
    }

    .tariff-names {
        align-items: center;
        width: 100%;
    }

    .provider-name {
        font-size: 20px;
    }

    .tariff-title {
        font-size: 14px;
    }

    /* Price and Speed in one row */
    .tariff-specs-row {
        display: flex;
        justify-content: space-around;
        width: 100%;
        gap: 20px;
        margin: 15px 0;
    }

    .tariff-spec {
        align-items: center;
    }

    .spec-label {
        font-size: 11px;
    }

    .spec-value {
        font-size: 20px;
    }

    .spec-sub {
        font-size: 12px;
    }

    /* Hidden tariffs - smaller fonts */
    .hidden-tariffs .tariff-card {
        padding: 15px 12px;
    }

    .hidden-tariffs .provider-name {
        font-size: 16px;
    }

    .hidden-tariffs .tariff-title {
        font-size: 12px;
    }

    .hidden-tariffs .spec-value {
        font-size: 16px;
    }

    .hidden-tariffs .spec-label {
        font-size: 10px;
    }

    .hidden-tariffs .spec-sub {
        font-size: 11px;
    }
}

.price-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.price-period {
    color: var(--text-muted);
    font-size: 14px;
}

.tariff-features {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.feature-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.tariff-actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.1);
}

.show-all-tariffs {
    text-align: center;
    margin-top: 16px;
}

.show-all-btn {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.show-all-btn:hover {
    background: var(--primary);
    color: white;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state svg {
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-muted);
}


/* Modal Styles from SpeedTest */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #1a1b26;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff 20%, #a5b4fc 40%, #a5b4fc 60%, #fff 80%);
    background-size: 200% auto;
    color: #000;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.modal-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Floating Label Input */
.input-group {
    position: relative;
    margin-bottom: 25px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.input-group input {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 1.3rem;
    text-align: left;
    padding-left: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #667eea;
}

.input-group label {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: all 0.2s ease;
    background: #1a1b26;
    padding: 0 5px;
    white-space: nowrap;
}

.input-group input:focus+label,
.input-group input:not(:placeholder-shown)+label {
    top: 0;
    font-size: 0.8rem;
    color: #667eea;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    text-align: left;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0;
    accent-color: #667eea;
    transform: scale(1.5);
    margin-right: 5px;
}

.checkbox-group a {
    color: #667eea;
    text-decoration: none;
}

.checkbox-group a:hover {
    text-decoration: underline;
}

/* Submit Button */
.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.6);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tariff Info in Modal */
.modal-tariff-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 0.9rem;
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-tariff-info strong {
    color: #fff;
    display: block;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.toast.error {
    border-color: var(--error);
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 16px;
    }

    .search-wrapper {
        flex-direction: column;
    }

    .filters {
        flex-direction: column;
    }

    .tariff-header {
        flex-direction: column;
        gap: 12px;
    }

    .tariff-price {
        text-align: left;
    }

    .tariff-actions {
        flex-direction: column;
    }
}