/* Modern Header Styles using CSS Grid and Flexbox */

/* Header Grid Layout */
.header-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "logo nav actions";
    align-items: center;
    gap: 2rem;
    padding: 0.5rem 1rem;
    min-height: 60px;
}

/* Logo Section */
.header-logo {
    grid-area: logo;
    display: flex;
    align-items: center;
}

.logo-container {
    position: relative;
    display: inline-block;
    text-decoration: none;
}

.logo-container:hover {
    text-decoration: none;
}

.header-logo .site-logo {
    width: 120px;
    height: auto;
    max-height: 50px;
    object-fit: contain;
}

/* Market Indicator (like YouTube's regional indicator) */
.logo-market-indicator {
    position: absolute;
    top: 0px;
    right: -8px;
    color: #27a94c;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 1px 4px;
    border-radius: 2px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
}

/* Mobile logo adjustments */
.mobile-logo .logo-market-indicator {
    top: 0px;
    right: -6px;
    font-size: 0.55rem;
    padding: 1px 3px;
}

/* Sidebar logo adjustments */
.sidebar-logo .logo-market-indicator {
    top: -2px;
    right: -6px;
    font-size: 0.55rem;
    padding: 1px 3px;
}

/* Hover effect for market indicator */
.logo-container:hover .logo-market-indicator {
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* Navigation Section */
.header-nav {
    grid-area: nav;
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
    align-items: center;
}

.nav-menu li a {
    color: #575656;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 400;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-menu li a:hover {
    color: #27a94c;
    text-decoration: none;
}

/* Actions Section */
.header-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
}

.header-actions-flex {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Country Selector Wrapper */
.country-selector-wrapper {
    display: flex;
    align-items: center;
}

.country-selector-wrapper .country-selector {
    margin: 0;
}

/* User Section (Logged in) */
.user-section {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #575656;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #575656;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.inbox-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #575656;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.inbox-link:hover {
    color: #27a94c;
    background-color: #f8f9fa;
    text-decoration: none;
}

.inbox-count {
    font-size: 0.75rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-primary {
    background-color: #27a94c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: #229a43;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: #575656;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
    border-color: #aaa;
    color: #575656;
    text-decoration: none;
}

/* Guest Section */
.guest-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #575656;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.login-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #575656;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-grid {
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .user-name {
        max-width: 100px;
    }
}

@media (max-width: 992px) {
    .header-grid {
        grid-template-columns: auto 1fr;
        grid-template-areas: 
            "logo actions"
            "nav nav";
        gap: 1rem;
    }
    
    .header-nav {
        justify-content: flex-start;
        padding-top: 0.5rem;
    }
    
    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
    }
}

/* Override old header styles */
.header-ul {
    display: none !important;
}

/* Keep the old header height */
header {
    height: auto;
    min-height: 3.75rem;
    background-color: #fff;
    padding: 0.5rem 0;
    width: 100%;
    z-index: 99;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Country selector improvements */
.country-selector .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #575656;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.country-selector .dropdown-toggle:hover {
    border-color: #aaa;
    background: #f8f9fa;
    text-decoration: none;
    color: #575656;
}

/* Modern Sidebar Styles */
.modern-sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e9ecef;
    padding: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.sidebar-header .sidebar-logo .site-logo {
    width: 100px;
    height: auto;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #575656;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: #e9ecef;
    color: #333;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* User Section */
.sidebar-user-section,
.sidebar-guest-section {
    margin-bottom: 2rem;
}

.user-profile-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar,
.guest-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-details {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.user-status {
    display: block;
    font-size: 0.875rem;
    color: #666;
    text-transform: capitalize;
}

/* Guest Section */
.guest-welcome {
    text-align: center;
    margin-bottom: 1.5rem;
}

.guest-message {
    margin: 1rem 0;
    color: #666;
    font-size: 0.9rem;
}

/* Sidebar Actions */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.sidebar-btn-primary {
    background: #27a94c;
    color: white;
}

.sidebar-btn-primary:hover {
    background: #229a43;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.sidebar-btn-secondary {
    background: transparent;
    color: #27a94c;
    border: 1px solid #27a94c;
}

.sidebar-btn-outline {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.sidebar-btn-outline:hover {
    background: #dc3545;
    color: white;
    text-decoration: none;
}

/* Navigation */
.sidebar-nav {
    margin-top: 1rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #575656;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-menu-item:hover {
    background: #f8f9fa;
    color: #27a94c;
    text-decoration: none;
    transform: translateX(4px);
}

.sidebar-menu-item i {
    width: 16px;
    text-align: center;
}

/* Footer */
.sidebar-footer {
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 20px));
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    margin-bottom: 0;
}

.sidebar-logout {
    margin-bottom: 1rem;
}

.sidebar-country-selector {
    text-align: center;
}

.country-selector-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.sidebar-country-selector .country-selector {
    margin: 0;
}

.sidebar-country-selector .country-selector .dropdown-toggle {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
}

/* Sidebar animations */
body.show-menu .sidebar-overlay {
    display: block;
}

body.show-menu .sidebar {
    transform: translate3d(0, 0, 0);
}

/* Mobile responsiveness */
@media (max-width: 767px) {
    .sidebar {
        width: 90%;
        max-width: 320px;
    }
    
    .sidebar-content {
        padding: 1rem;
    }
    
    .sidebar-header {
        padding: 0.5rem 1rem;
    }
    
    .user-profile-card {
        padding: 1rem;
    }
    
    .sidebar-footer {
        padding: 1rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 25px));
    }
}
