/**
 * 땅튜브 헤더 스타일
 *
 * @package DdangTube
 * @version 2.0.0
 */


/* ========== Header (전체 너비, 최상단) ========== */

.ddangtube-header {
    border-bottom: 1px solid #242528;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    height: var(--header-height, 56px);
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
}

.header-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
}


/* ========== Sidebar Toggle Button (햄버거) ========== */

.header-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    padding: 0;
}

.header-sidebar-toggle:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}


/* ========== Logo ========== */

.header-logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.header-logo-link:hover {
    opacity: 0.85;
}

.header-logo-image {
    width: auto;
    height: 32px;
    max-width: 100px;
    object-fit: contain;
    border-radius: 50%;
}

.header-logo-text {
    font-size: 1.2rem;
    font-weight: 900;
    font-family: 'Galmuri11', sans-serif;
    color: var(--text-primary);
    white-space: nowrap;
}


/* ========== Search ========== */

.header-search {
    flex: 1;
    max-width: 300px;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-form .search-field {
    width: 100%;
    padding: 0.7rem 2.5rem 0.7rem 1.2rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-form .search-field::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b5bac1' stroke-width='2.5' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    cursor: pointer;
}

.search-form .search-field::placeholder {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.search-submit {
    position: absolute;
    right: 0.375rem;
    padding: 0.35rem;
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.search-submit svg {
    width: 16px;
    height: 16px;
}

.search-submit:hover {
    color: var(--accent-primary);
}


/* ========== Right Menu ========== */

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    margin-left: auto;
}


/* ========== User Menu ========== */

.header-user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-family: 'Galmuri11', sans-serif;
}

.header-user-menu a {
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'Galmuri11', sans-serif;
    transition: color var(--transition-fast);
}

.header-user-menu a:hover {
    color: var(--text-primary);
}

.header-user-menu .separator {
    color: var(--text-muted);
}


/* ========== User Profile Link ========== */

.header-user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast);
}

.header-user-profile:hover {
    background-color: var(--bg-hover);
}

.header-user-profile__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.header-user-profile__name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ========== Google Login Button ========== */

.header-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background-color var(--transition-fast);
    white-space: nowrap;
}

.header-login-btn:hover {
    background-color: var(--bg-hover);
}

.header-login-btn .google-icon {
    flex-shrink: 0;
}


/* ========== Responsive ========== */

@media (max-width: 768px) {
    .ddangtube-header {
        padding: 0 1.2rem;
        height: var(--header-height-mobile, 52px);
    }

    .header-logo-link {
        margin-right: 0;
    }

    .header-container {
        gap: 0.5rem;
    }

    .header-logo-text {
        font-size: 1rem;
    }

    .header-search {
        flex: 1;
        max-width: none;
    }

    .header-user-menu {
        font-size: 0.85rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .ddangtube-header {
        height: var(--header-height-mobile, 48px);
    }

    .header-logo-text {
        display: none;
    }

    .header-logo-image {
        height: 28px;
    }

    .header-user-profile__name {
        display: none;
    }

    .header-user-profile {
        padding: 0.125rem;
    }

    .header-user-menu a:not(.header-user-profile):not(.header-login-btn) {
        display: none;
    }

    .header-user-menu .separator {
        display: none;
    }

    .header-login-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .header-right {
        gap: 0.5rem;
    }
}