* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


/* NAVBAR & HEADER */
.navbar { background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 8px rgba(0,0,0,0.04); width: 100%; }
.nav-container { max-width: 1280px; margin: 0 auto; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 15px; width: 100%; }
.logo { font-size: 1.2rem; font-weight: 800; color: #e63946; text-decoration: none; white-space: nowrap; }

.nav-right-side { display: flex; align-items: center; gap: 20px; flex: 1; justify-content: flex-end; }
.nav-menu { display: flex; align-items: center; gap: 15px; list-style: none; }
.nav-menu a { text-decoration: none; color: #1d3557; font-weight: 600; font-size: 0.9rem; transition: color 0.2s; white-space: nowrap; }
.nav-menu a:hover, .nav-menu a.active { color: #e63946; }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.btn-add-recipe { background: #e63946; color: #fff !important; padding: 8px 14px; border-radius: 20px; font-weight: 700 !important; display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 4px 10px rgba(230,57,70,0.2); text-decoration: none; font-size: 0.82rem; white-space: nowrap; }
.btn-add-recipe:hover { background: #d62828; }

.btn-auth-trigger { background: #1d3557; color: #fff; border: none; padding: 8px 14px; border-radius: 20px; font-weight: 600; font-size: 0.82rem; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block; }
.btn-auth-trigger:hover { background: #457b9d; }

.btn-register-trigger { background: #e0f2fe; color: #0369a1; border: none; padding: 8px 14px; border-radius: 20px; font-weight: 600; font-size: 0.82rem; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-block; }
.btn-register-trigger:hover { background: #bae6fd; }

/* Елементи, видими само в мобилното меню */
.mobile-auth-item { display: none; }

/* USER DROPDOWN */
.user-dropdown { position: relative; display: inline-block; }
.dropdown-toggle { background: #1d3557; color: #fff; border: none; padding: 8px 14px; border-radius: 20px; font-weight: 600; font-size: 0.82rem; cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.dropdown-content { display: none; position: absolute; right: 0; top: 110%; background-color: #fff; min-width: 200px; box-shadow: 0 10px 25px rgba(0,0,0,0.12); z-index: 1001; border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; }
.dropdown-content.show { display: block; }
.dropdown-content a { color: #2b2d42; padding: 12px 14px; text-decoration: none; display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; transition: background 0.2s; }
.dropdown-content a:hover { background-color: #f1f5f9; color: #e63946; }
.dropdown-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }

.hamburger-btn { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #1d3557; padding: 4px; }

/* AUTH MODAL STYLES */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 99999; display: none; align-items: center; justify-content: center; padding: 15px; }
.modal-overlay.show { display: flex !important; }
.modal-card { background: #fff; width: 100%; max-width: 420px; padding: 24px; border-radius: 14px; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: scaleUp 0.2s ease-in-out; max-height: 90vh; overflow-y: auto; }
@keyframes scaleUp { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close { position: absolute; top: 12px; right: 15px; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #64748b; }
.modal-close:hover { color: #e63946; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; }
.tab-btn { flex: 1; padding: 10px; background: #f1f5f9; border: none; border-radius: 8px; font-weight: 700; font-size: 0.9rem; cursor: pointer; color: #64748b; transition: all 0.2s; }
.tab-btn.active { background: #1d3557; color: #fff; }

.social-login { display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px; }
.btn-social { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border-radius: 8px; font-weight: 600; font-size: 0.88rem; text-decoration: none; border: 1px solid #cbd5e1; background: #fff; color: #2b2d42; transition: background 0.2s; }
.btn-google:hover { background: #f8fafc; }
.btn-facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.btn-facebook:hover { background: #166fe5; }

.social-divider { text-align: center; position: relative; margin: 15px 0; }
.social-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: #e2e8f0; }
.social-divider span { position: relative; background: #fff; padding: 0 10px; font-size: 0.78rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { font-size: 0.8rem; font-weight: 700; color: #475569; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.88rem; outline: none; background: #fff; }
.form-group input:focus { border-color: #1d3557; }

.btn-modal-submit { background: #1d3557; color: #fff; border: none; padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; width: 100%; font-size: 0.95rem; transition: background 0.2s; margin-top: 5px; }
.btn-modal-submit:hover { background: #457b9d; }

/* ==================== ФИКС ЗА CLS ==================== */
/* Предотвратяване на layout shift от AdSense */
html body .container,
html body div.container {
    min-height: 100vh; /* Вместо 500px - по-добре за мобилни */
    height: auto;
    contain: layout style;

html body .recipe-card {
    min-height: 350px !important;
    contain: layout style !important;
}

html body ins.adsbygoogle {
    min-height: 280px !important;
    display: block !important;
    background: #f8f9fa !important;
    contain-intrinsic-size: auto 280px !important;
    content-visibility: auto !important;
}

/* Предотвратяване на AdSense override */
html body .container[style] {
    min-height: 500px !important;
}

/* Фиксирани размери за изображения */
img {
    max-width: 100%;
    height: auto;
}

.avatar {
    width: 22px !important;
    height: 22px !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .hamburger-btn { display: block; order: 1; }
    .logo { order: 2; }
    .nav-right-side { 
        display: none; 
        position: absolute; 
        top: 100%; 
        left: 0; 
        width: 100%; 
        background: #fff; 
        flex-direction: column; 
        align-items: stretch;
        padding: 15px 20px; 
        border-bottom: 1px solid #e2e8f0; 
        box-shadow: 0 8px 20px rgba(0,0,0,0.08); 
        z-index: 1000; 
        gap: 15px; 
    }
    .nav-right-side.show { display: flex; }
    
    .mobile-auth-item { display: block; }
    .nav-actions .btn-auth-trigger, .nav-actions .btn-register-trigger { display: none; }

    .nav-menu { flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
    .nav-menu li { width: 100%; }
    .nav-menu a { display: block; padding: 10px; border-radius: 8px; }
    .nav-menu a:hover, .nav-menu a.active { background: #f1f5f9; }
    
    .nav-actions { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
    .nav-actions a, .nav-actions button { width: 100%; text-align: center; justify-content: center; }
    
    .user-dropdown { width: 100%; }
    .dropdown-toggle { width: 100%; justify-content: center; }
    .dropdown-content { position: static; width: 100%; box-shadow: none; border: none; margin-top: 5px; }
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    color: #1d3557;
    padding: 10px;
    z-index: 10000;
}
.skip-link:focus {
    left: 0;
    top: 0;
}