/* Header Wrapper for fixed positioning */
.header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 5px 10px;
    background: transparent;
}

/* Spacer to prevent content from hiding under fixed header */
body {
    padding-top: 80px;
}

header {
    padding: 15px 20px;
    margin: 0 auto;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

header:hover {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

header img {
    height: 40px;
    width: auto;
}

header .buttons {
    display: flex;
    gap: 12px;
}

header .buttons a {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 22px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

header .buttons a.sign-in,
header .buttons .sign-in {
    background-color: var(--yellow);
    color: white !important;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

header .buttons a.register,
header .buttons .register {
    background-color: var(--green);
    color: white !important;
    box-shadow: 0 4px 15px rgba(16, 195, 108, 0.3);
}

header .buttons .sign-in:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

header .buttons .register:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 195, 108, 0.4);
}

header .buttons a:active {
    transform: translateY(0);
}

/* User info styles */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 25px;
    color: #333;
}

.user-info .fa-user {
    font-size: 18px;
    color: #666;
}

.username {
    font-weight: 500;
}

.user-welcome {
    color: #333;
    font-weight: 500;
    margin-right: 15px;
}

.logout-btn {
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.4);
}


/* Кнопка админ панела в хедере */
.btn-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0 !important;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(140deg, var(--green), var(--yellow));
    color: white !important;
    text-decoration: none !important;
    margin-right: 0;
    transition: all 0.3s ease;
    position: relative;
    border: none;
    transform: translateY(2px);
}

.btn-admin i {
    font-size: 16px;
    line-height: 1;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.btn-admin:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(229, 253, 229, 0.5);
}

/* Кнопка чата в хедере */
.btn-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    width: 38px;
    height: 38px;
    min-height: 38px !important;
    max-height: 38px !important;
    flex-shrink: 0;
    border-radius: 8px;
    color: var(--text-secondary, #555);
    text-decoration: none;
    margin-right: 15px;
    transition: color 0.2s ease;
    position: relative;
    border: none;
}

.btn-chat i {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s, color 0.2s;
}

.btn-chat:hover {
    color: var(--primary, #10c36c);
    transform: translateY(-2px);
}

/* Индикатор непрочитанных сообщений (красная точка) */
.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    max-width: 10px;
    max-height: 10px;
    background: #ff4757;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
    padding: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

.chat-badge.has-unread {
    display: block;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

/* Адаптивность для мобильных */
@media screen and (max-width: 480px) {
    .btn-chat {
        width: 36px;
        height: 36px;
        min-height: 36px !important;
        max-height: 36px !important;
        margin-right: 8px;
        transform: translateY(1px);
    }
    
    .btn-chat i {
        font-size: 16px;
    }
    
    .btn-admin {
        width: 34px;
        height: 34px;
        margin-right: 6px;
    }
    
    .btn-admin i {
        font-size: 16px;
    }
}

/* Tablets (768px - 1024px) */
@media screen and (max-width: 1024px) {

    .header-wrapper {
        padding: 8px 10px;
    }
    
    body {
        padding-top: 70px;
    }
    
    header {
        padding: 12px 18px;
    }
    
    header img {
        height: 35px;
    }
    
    header .buttons a {
        font-size: 14px;
        padding: 8px 18px;
    }
}

/* Mobile devices (480px - 767px) */
@media screen and (max-width: 767px) {
    .header-wrapper {
        padding: 5px 8px;
    }
    
    body {
        padding-top: 65px;
    }
    
    header {
        padding: 10px 15px;
        border-radius: 15px;
    }
    
    header img {
        height: 30px;
    }
    
    header .buttons {
        gap: 8px;
    }
    
    header .buttons a {
        font-size: 13px;
        padding: 8px 14px;
        border-radius: 10px;
    }

    .btn-admin {
        display: none !important;
    }
}

/* Small mobile devices (up to 479px) */
@media screen and (max-width: 479px) {
    .header-wrapper {
        padding: 5px 6px;
    }
    
    body {
        padding-top: 60px;
    }
    
    header {
        padding: 10px 12px;
        flex-direction: row;
        gap: 10px;
    }
    
    header img {
        height: 25px;
    }
    
    header .buttons {
        gap: 6px;
    }
    
    header .buttons a {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Very small screens (up to 320px) */
@media screen and (max-width: 320px) {
    .header-wrapper {
        padding: 4px 5px;
    }
    
    body {
        padding-top: 55px;
    }
    
    header {
        padding: 8px 10px;
    }
    
    header img {
        height: 22px;
    }
    
    header .buttons a {
        font-size: 11px;
        padding: 5px 10px;
    }

}

/* Bigger chat and profile buttons, smaller logout */
@media screen and (max-width: 768px) {
    .btn-chat {
        width: 44px;
        height: 44px;
        min-height: 44px !important;
        max-height: 44px !important;
        margin-right: 8px;
    }
    
    .btn-chat i {
        font-size: 24px;
    }
    
    .user-info .fa-user,
    .btn-profile {
        font-size: 24px;
        width: 44px;
        height: 44px;
    }
    
    .logout-btn {
        padding: 6px 12px;
        font-size: 11px;
        border-radius: 8px;
    }
}

@media screen and (max-width: 480px) {
    .btn-chat {
        width: 40px;
        height: 40px;
        min-height: 40px !important;
        max-height: 40px !important;
        margin-right: 6px;
    }
    
    .btn-chat i {
        font-size: 22px;
    }
    
    .logout-btn {
        padding: 5px 10px;
        font-size: 10px;
    }
}

/* Mobile header fixes */
@media screen and (max-width: 768px) {
    header img {
        height: 26px;
    }
    
    .btn-chat {
        width: 42px;
        height: 42px;
        min-height: 42px !important;
        max-height: 42px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        transform: translateY(3px);
    }
    
    .btn-chat i {
        font-size: 22px;
    }
    
    /* Fix profile icon alignment */
    .user-info .fa-user {
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
    }
    
    .logout-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media screen and (max-width: 480px) {
    header img {
        height: 24px;
    }
    
    .btn-chat {
        width: 38px;
        height: 38px;
        min-height: 38px !important;
        max-height: 38px !important;
        margin-right: 4px;
        transform: translateY(3px);
    }
    
    .btn-chat i {
        font-size: 20px;
    }
    
    .user-info .fa-user {
        font-size: 20px;
        width: 38px;
        height: 38px;
    }
    
    .logout-btn {
        padding: 5px 8px;
        font-size: 10px;
    }
}

@media screen and (max-width: 390px) {
    header img {
        height: 22px;
    }
    
    .btn-chat {
        width: 36px;
        height: 36px;
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .btn-chat i {
        font-size: 18px;
    }
    
    .user-info .fa-user {
        font-size: 18px;
        width: 36px;
        height: 36px;
    }
}
