:root {
    --primary: #0061ff;
    --primary-hover: #0052d9;
    --primary-light: #eef2ff;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* { box-sizing: border-box; }

.grecaptcha-badge { 
    visibility: hidden; 
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { 
    width: 92%; 
    max-width: 1000px; 
    margin: 0 auto; 
}

.lang-bar {
    background: var(--bg-card);
    display: flex;
    justify-content: flex-end;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
}

.lang-bar button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 13px;
}

.compact-hero {
    background: white;
    padding: 40px 0;
    text-align: center;
}

.logo { 
    color: var(--text-main); 
    margin: 0; 
    letter-spacing: -1.5px; 
    font-size: 70px; 
    font-weight: 850; 
}

.logo span { color: var(--primary); }

.filter-sticky {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.scroll-x { 
    display: flex; 
    gap: 8px; 
    overflow-x: auto; 
    scrollbar-width: none; 
}

.scroll-x::-webkit-scrollbar { display: none; }

.filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-main);
    font-weight: 500;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.add-firm-btn {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s;
}

.add-firm-btn:hover { transform: translateY(-1px); background: var(--primary-hover); }

.listing-area { padding: 30px 0 80px; }

.firm-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    padding: 24px;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
    gap: 24px;
    box-shadow: var(--shadow-sm);
}

.firm-row:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.firm-image {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.firm-image img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }

.firm-main { flex: 1; }
.name { margin: 0 0 6px 0; font-size: 22px; font-weight: 700; color: var(--text-main); }
.meta-data { font-size: 15px; color: var(--text-muted); }

.firm-actions { display: flex; align-items: center; gap: 30px; }
.tel-link { font-size: 20px; font-weight: 700; color: var(--primary); text-decoration: none; }
.visit-btn {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    z-index: 1001;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal.active { display: block; }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-overlay.active { display: block; }

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { margin: 0; font-size: 20px; }

.close-btn { 
    background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text-muted);
}

.modal-step { padding: 24px; }
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-main);
    font-size: 16px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 97, 255, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

.back-btn {
    width: 100%;
    padding: 12px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
}

.logo-upload {
    border: 2px dashed var(--border);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
}

.logo-preview {
    margin-top: 15px;
    position: relative;
    width: 100px;
    height: 100px;
}

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

.remove-logo-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    border: none;
    cursor: pointer;
}

.user-firms-list { margin-top: 20px; }

.user-firm-item {
    background: var(--bg-main);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#loader-sentinel {
    height: 50px; /* Must have height to be 'seen' */
    width: 100%;
    clear: both;
}

.hidden { display: none !important; }

@media (max-width: 768px) {
    .firm-row { flex-direction: column; text-align: center; }
    .firm-actions { flex-direction: column; width: 100%; gap: 15px; border-top: 1px solid var(--border); padding-top: 20px; }
    .visit-btn { width: 100%; }
}

/* 1. Position the container at the top */
#toast-container {
    position: fixed;
    top: 20px;          /* Distance from top */
    right: 20px;        /* Distance from right */
    width: auto;
    max-width: 350px;   /* Prevents it from being too wide */
    z-index: 99999;     /* Higher than modals (usually 1000-2000) */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Allows clicking things 'through' the empty container */
}

/* 2. Individual Toast Styling (assuming you create a div inside) */
.toast {
    pointer-events: auto; /* Re-enable clicks for the actual notification */
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.9rem;
    animation: slideInDown 0.3s ease-out; /* Smooth entrance */
}

.toast.success { border-left: 4px solid #2ecc71; }
.toast.error   { border-left: 4px solid #e74c3c; }

/* 3. Mobile responsiveness */
@media (max-width: 600px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;    /* Center on mobile */
        max-width: none;
    }
}

/* 4. Smooth Animation */
@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}
.cookie-banner.hidden {
    display: none;
}
.cookie-buttons {
    display: flex;
    gap: 10px;
}
@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

.filter-sticky {
    background: #fff;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Top Row Styles */
.nav-top-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.search-wrapper {
    flex: 1;
}

.search-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
    outline: none;
}

/* The Blue "Postita" Button */
.main-blue-btn {
    background: #007bff; /* Professional Blue */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.main-blue-btn:hover {
    background: #0056b3;
}

/* Categories Grid (The Wrapping Part) */
.nav-categories-grid {
    display: flex;
    flex-wrap: wrap; /* This allows buttons to go to the next line */
    gap: 8px;
    justify-content: flex-start;
}

.filter-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #343a40;
    color: white;
    border-color: #343a40;
}

.city-select-nav {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #dee2e6;
    background: #fff;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Responsive adjustment: Make buttons slightly bigger for thumbs on mobile */
@media (max-width: 600px) {
    .filter-btn {
        padding: 10px 16px;
        flex-grow: 1; /* Makes them fill the row evenly on small screens */
        text-align: center;
    }
}

.firm-card.premium {
    border: 2px solid #ffd700; /* Gold border */
    background: #fffcf0; /* Very light gold background */
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
    position: relative;
}

.premium-badge {
    position: absolute;
    top: -12px;
    right: 15px;
    background: #ffd700;
    color: #333;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Upgrade Button inside the user's profile */
.upgrade-btn {
    background: linear-gradient(135deg, #ffd700, #ffb900);
    color: #333;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.upgrade-btn:hover {
    background: linear-gradient(135deg, #ffb900, #ff9900);
}

.rating-container {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 8px;
}

.star {
    font-size: 1.4rem;
    cursor: pointer;
    color: #dcdde1; 
    transition: transform 0.1s, color 0.2s;
}

.star:hover {
    transform: scale(1.1);
}

.star.filled {
    color: #f1c40f; 
}

.rating-score {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-left: 8px;
    font-weight: bold;
}