/* ==========================================================================
   HEADER STYLES
   ViaHomeopatica Theme
   ========================================================================== */

/* ===== HEADER ===== */
.site-header {
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

/* Login Button */
.login-btn {
    display: inline-block;
    padding: 6px 16px;
    background: #6b8e7e;
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 15px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.login-btn:hover {
    background: #5a7c6e;
    transform: translateY(-2px);
}

body.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

@media (max-width: 600px) {
    body.admin-bar .site-header {
        top: 0;
    }
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Nav bar container - full width */
.header-nav-bar .header-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Top Bar */
.header-top-bar {
    background: var(--header-bg);
    height: var(--header-top-height);
}

.header-top-bar .header-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.site-branding {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 100%;
    z-index: 2;
}

.site-logo-text {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    transition: opacity 0.2s ease;
    padding: 0.5rem 0;
    height: 100%;
}

.site-logo-image {
    max-height: 50px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.site-logo-text:hover {
    opacity: 0.85;
    text-decoration: none !important;
}

/* Centered title block */
.header-title-centered {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1;
}

.centered-title-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none !important;
    transition: opacity 0.2s ease;
}

.centered-title-link:hover {
    opacity: 0.85;
    text-decoration: none !important;
}

.centered-title-link .logo-main {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 0.02em;
    display: block;
    line-height: 1.1;
    text-align: center;
}

.centered-title-link .logo-tagline {
    font-size: 1.25rem;
    font-weight: 700;
    display: block;
    margin-top: 0.1rem;
    letter-spacing: 0.03em;
    text-align: center;
}

.centered-title-link .logo-tagline .tagline-text {
    color: #734c75;
    font-weight: 400;
}

.centered-title-link .logo-tagline .brand-name {
    font-weight: 600;
}

.centered-title-link .logo-tagline .brand-name .brand-via {
    color: #2c3e50;
}

.centered-title-link .logo-tagline .brand-name .brand-homeo {
    color: #1892AE;
}

.centered-title-link .logo-tagline .brand-name .brand-patica {
    color: #B56CC5;
}

.site-logo-text .logo-tagline .tagline-text {
    color: #734c75;
    font-weight: 400;
}

.site-logo-text .logo-tagline .brand-name {
    font-weight: 600;
}

.site-logo-text .logo-tagline .brand-name .brand-via {
    color: #2c3e50;
}

.site-logo-text .logo-tagline .brand-name .brand-homeo {
    color: #1892AE;
}

.site-logo-text .logo-tagline .brand-name .brand-patica {
    color: #B56CC5;
}

.site-logo-text:hover {
    opacity: 0.8;
}

/* Profile dropdown - hidden on desktop */
.profile-link .profile-dropdown {
    display: none;
}

/* Profile */
.header-profile {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0 0.375rem 0.75rem !important;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
    text-decoration: none;
    margin-left: 0.75rem !important;
}

.profile-link:hover {
    border-color: #6b8e7e;
    box-shadow: var(--shadow-sm);
    background: var(--bg-miasm);
}

.profile-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.profile-badge.badge-student {
    background: var(--badge-student-bg);
    color: var(--badge-student-text);
}

.profile-badge.badge-club {
    background: var(--badge-club-bg);
    color: var(--badge-club-text);
}

.profile-badge.badge-teacher {
    background: var(--badge-teacher-bg);
    color: var(--badge-teacher-text);
}

.profile-badge.badge-admin {
    background: var(--badge-admin-bg);
    color: var(--badge-admin-text);
}

.profile-badge.badge-guest {
    background: var(--badge-guest-bg);
    color: var(--badge-guest-text);
}

.profile-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.profile-arrow {
    color: var(--text-light);
    transition: transform var(--transition-fast);
}

.profile-link:hover .profile-arrow {
    transform: rotate(180deg);
    color: #1892AE;
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--text-light);
    transition: all var(--transition-fast);
    margin-left: 0 !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
}

.logout-link:hover {
    background: var(--bg-miasm);
    color: #1892AE;
}

.guest-message {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

/* Navigation Bar */
.header-nav-bar {
    background: var(--primary);
    min-height: var(--header-nav-height);
    display: flex;
    align-items: center;
}

/* ===== RESPONSIVE - планшет (сужение) ===== */
@media (max-width: 1000px) {
    /* Hide profile badge (role), keep name visible */
    .profile-badge {
        display: none !important;
    }

    .profile-link {
        padding: 0.375rem 0 0.375rem 0.5rem !important;
        position: relative;
    }

    /* Dropdown popup below profile on hover */
    .profile-link .profile-dropdown {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        padding: 0.5rem 0.75rem;
        min-width: 150px;
        text-align: center;
        z-index: 999;
        margin-top: 6px;
    }

    .profile-link .profile-dropdown .dropdown-role {
        display: block;
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
        color: #734c75;
    }

    .profile-link .profile-dropdown .dropdown-name {
        display: block;
        font-size: 0.85rem;
        color: #2c3e50;
    }

    .profile-link:hover .profile-dropdown {
        display: block;
    }
}

/* ===== RESPONSIVE - узкий планшет ===== */
@media (max-width: 800px) {
    /* Hide profile name too, only show dropdown on hover */
    .profile-name {
        display: none !important;
    }

    /* Reduce centered title size so it doesn't overlap */
    .centered-title-link .logo-main {
        font-size: 1.4rem;
    }

    .centered-title-link .logo-tagline {
        font-size: 0.85rem;
    }
}

/* ===== RESPONSIVE - логотип меньше ===== */
@media (max-width: 700px) {
    .site-logo-image {
        max-height: 35px;
    }
}

/* ===== RESPONSIVE - мобильная версия ===== */
@media (max-width: 660px) {
    .header-container {
        padding: 0 0.5rem !important;
    }

    .header-nav-bar .header-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .header-top-bar {
        height: auto;
    }

    .header-top-bar .header-container {
        display: flex;
        align-items: center !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        position: relative;
        column-gap: 0.75rem;
        row-gap: 0.5rem;
        padding-top: 0.625rem;
        padding-bottom: 0.75rem;
    }

    .site-branding {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        height: auto;
        z-index: 2;
    }

    .site-logo-text {
        height: auto;
        padding: 0.25rem 0;
    }

    .header-title-centered {
        position: static;
        left: auto;
        transform: none;
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        text-align: center;
        z-index: 1;
        margin-top: 0.125rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-light);
    }

    .centered-title-link {
        gap: 0.15rem;
    }

    .centered-title-link .logo-main {
        font-size: 1rem;
        line-height: 1.25;
        max-width: 18rem;
        margin: 0 auto;
    }

    .centered-title-link .logo-tagline {
        display: block;
        font-size: 0.9rem;
        margin-top: 0;
    }

    .header-profile {
        flex-shrink: 0;
        gap: 0.5rem;
        height: auto;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-left: auto;
        min-width: 0;
    }

    .profile-link {
        padding: 0.375rem 0 0.375rem 0.75rem !important;
        align-items: center;
    }

    .profile-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .profile-name {
        display: none;
    }

    /* Dropdown popup below profile on hover */
    .profile-link {
        position: relative;
    }

    .profile-link .profile-dropdown {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        padding: 0.5rem 0.75rem;
        min-width: 150px;
        text-align: center;
        z-index: 999;
        margin-top: 6px;
    }

    .profile-link .profile-dropdown .dropdown-role {
        display: block;
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
        color: #734c75;
    }

    .profile-link .profile-dropdown .dropdown-name {
        display: block;
        font-size: 0.85rem;
        color: #2c3e50;
    }

    .profile-link:hover .profile-dropdown {
        display: block;
    }

    .logout-link {
        width: 32px;
        height: 32px;
    }

    .header-profile {
        width: auto;
        justify-content: flex-end;
        margin-top: 0;
    }

    .guest-message {
        font-size: 0.78rem;
        line-height: 1.2;
        text-align: right;
        white-space: nowrap;
    }

    .header-profile .login-btn {
        margin-left: 0;
        padding: 0.375rem 0.8rem;
        font-size: 0.82rem;
        line-height: 1.2;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 420px) {
    .header-top-bar .header-container {
        row-gap: 0.45rem;
        padding-top: 0.5rem;
        padding-bottom: 0.625rem;
    }

    .centered-title-link .logo-main {
        font-size: 0.95rem;
        max-width: 15rem;
    }

    .centered-title-link .logo-tagline {
        font-size: 0.8rem;
    }

    .guest-message {
        display: none;
    }

    .header-profile .login-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
}
