/* Import Inter Font */
@import url('../fonts/inter.css');

/* Alap stílusok és layout */
:root {
    --primary-color: #254B63;
    --primary-dark: #1e3d52;
    --primary-light: #2d5a74;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --white: #ffffff;
    --text-color: #333333;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global font inheritance - override browser defaults */
*, 
*::before, 
*::after,
html,
body,
button,
input,
textarea,
select {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

body {
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-variation-settings: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigációs sáv - moved below */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

/* Navigációs sáv */
.navbar {
    background: #373940;
    background: linear-gradient(90deg, rgba(55, 57, 64, 1) 0%, rgba(37, 75, 99, 1) 49%, rgba(45, 90, 116, 1) 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: none;
    margin: 0;
    padding: 0 1.25rem 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.nav-title.clickable {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.nav-title.clickable:hover {
    transform: scale(1.05);
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Subnav */
.subnav {
    background: #666666;
    background: linear-gradient(0deg,rgba(102, 102, 102, 1) 1%, rgba(135, 135, 135, 1) 100%);
    padding: 0;
    margin: 0;
    border-top: none;
    position: fixed;
    left: 0;
    top: 80px; /* Below the navbar */
    height: calc(100vh - 80px);
    width: 200px;
    z-index: 999;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.subnav-container {
    padding: 0;
    height: 100%;
}

.subnav-buttons {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

.subnav-btn {
    background: transparent;
    color: var(--white);
    border: none;
    padding: 1.2rem 1.25rem 1.2rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.subnav-btn .btn-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1); /* Make SVG white */
    transition: all 0.3s ease;
}

.subnav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subnav-btn:hover .btn-icon {
    transform: scale(1.1);
}

.subnav-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.subnav-btn.active .btn-icon {
    transform: scale(1.05);
}

/* Accordion functionality */
.accordion-btn {
    position: relative;
    justify-content: space-between !important;
}

.accordion-icon {
    color: var(--white);
    transition: transform 0.3s ease;
    margin-left: auto;
}

.accordion-btn.expanded .accordion-icon {
    transform: rotate(180deg);
}

.accordion-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.accordion-submenu.expanded {
    max-height: 400px; /* Increased to accommodate more items */
    overflow: visible; /* Allow content to show */
}

.submenu-item {
    padding: 12px 30px !important; /* Simplified padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem !important;
    min-height: 48px !important;
    height: auto !important;
    color: #ffffff !important; /* Fallback white color */
    color: var(--white) !important;
    line-height: 1.4 !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    z-index: 1 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    overflow: visible !important;
}

/* Complete reset for submenu buttons to fix inheritance issues */
.subnav-btn.submenu-item {
    background: transparent !important;
    color: #ffffff !important;
    border: none !important;
    padding: 12px 30px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    width: 100% !important;
    text-align: left !important;
    justify-content: flex-start !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    min-height: 48px !important;
    height: auto !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    overflow: visible !important;
    line-height: 1.4 !important;
}

/* Specific fix for email templates button */
#emailTemplatesBtn {
    visibility: visible !important;
    opacity: 1 !important;
}

.submenu-item .btn-icon {
    width: 16px !important;
    height: 16px !important;
    filter: brightness(0) invert(1) !important;
}

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.submenu-item.active {
    background: rgba(255, 255, 255, 0.2);
}

/* User info section */
.user-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0;
    transition: background-color 0.2s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
    object-fit: cover;
}

/* Apply white filter only to SVG fallback icon */
.profile-photo[src*=".svg"] {
    filter: brightness(0) saturate(100%) invert(100%);
}

.user-name {
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-role {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    font-size: 0.75rem;
    line-height: 1.2;
    margin-top: 0.125rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.chevron-icon {
    color: var(--white);
    transition: transform 0.2s ease;
}

.user-profile.active .chevron-icon {
    transform: rotate(180deg);
}

/* Dropdown menu */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
    border-radius: 0;
}

.dropdown-item-btn:hover {
    background: #f8f9fa;
}

.dropdown-item-btn svg {
    flex-shrink: 0;
    color: var(--secondary-text);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-logout-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: #dc3545;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0;
    transition: background-color 0.2s ease;
}

.dropdown-logout-btn:hover {
    background: #f8f9fa;
}

.dropdown-logout-btn svg {
    flex-shrink: 0;
}

/* Main content */
.main-content {
    max-width: calc(1400px - 200px); /* Reduced to account for sidebar */
    margin: 0 auto;
    margin-left: 200px; /* Account for sidebar width */
    padding: 2rem;
    min-height: calc(100vh - 80px); /* Adjust for navbar height only */
    width: calc(100% - 200px);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 0.1rem;
}

.page-header h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2rem;
    padding-top: 2rem;
}

.page-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-container input {
    flex: 1;
    min-width: 300px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0;
    font-size: 1rem;
}

.students-count {
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.main {
    flex: 1;
    padding: 2rem 0;
}

/* Search section */
.search-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#searchInput {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Students section */
.students-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.students-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.students-count {
    font-weight: 400;
    color: var(--secondary-color);
    padding-left: 0.6rem;
}

/* Footer */
.footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 1rem;
    z-index: 1001;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: var(--white);
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-title {
        font-size: 1.5rem;
    }
    
    .nav {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 200px;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-brand {
        gap: 0.75rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .nav-title {
        font-size: 1.25rem;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Mobile sidebar adjustments */
    .subnav {
        width: 250px;
        top: 80px; /* Keep same as desktop for consistency */
        height: calc(100vh - 80px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .subnav.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        transition: margin-left 0.3s ease;
    }
    
    .subnav-btn {
        padding: 1.2rem 1rem;
        font-size: 0.85rem;
        min-height: 48px; /* Better touch target */
    }
    
    .submenu-item {
        min-height: 44px; /* Ensure submenu items are also touchable */
    }
}

@media (max-width: 480px) {
    .subnav {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .subnav.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
}

/* Overlay for mobile menu */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
    
    .subnav {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 200px !important;
        width: calc(100% - 200px) !important;
    }
}
