/* General Page Structure */
#page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center; /* This centers all direct children horizontally */
  min-height: 100vh;
}

/* Container Base Styles */
.container-header, .container-main, .container-footer {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 10px;
  position: relative; /* Crucial for containing the overlay and content */
  z-index: 0;
}

.container-main {
  flex-grow: 1;
  max-width: 1200px;
}

/* --- REWRITTEN BACKGROUND LOGIC --- */
/* This is an optional overlay div that PHP adds *inside* the container */
.background-color-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* Sits on top of the container's background, but below content */
    border-radius: inherit; /* Matches the parent container's corners */
    pointer-events: none; /* Allows clicks to go through to content */
}

/* This div holds the actual content and sits on top of the background/overlay */
.container-content {
    position: relative;
    z-index: 2; /* Ensures content is always on top */
}


/* Contener #1 - Header */
.container-header {
  position: sticky;
  top: 0;
  transition: all 0.3s ease-in-out;
  padding: 0 20px; /* Header has different padding requirements */
  z-index: 1000; /* Increased z-index to ensure it's on top of everything */
}

.container-header.match-content {
  max-width: 1200px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;  /* Adjusted padding */
  padding-bottom: 10px; /* Adjusted padding */
  gap: 20px;
}

.logo {
    flex-shrink: 0;
}

.logo img {
  display: block;
  max-height: 50px;
}

.search-bar {
  flex-grow: 1;
  margin: 0;
  position: relative;
  max-width: 750px; /* Increased max-width */
}

.search-bar input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border-radius: 25px;
    border: 1px solid #ced4da;
    font-size: 1rem;
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.search-bar button:hover {
    background-color: #005bb5;
}
.search-bar button svg {
    color: white;
    width: 20px;
    height: 20px;
}

/* --- NEW Styles for Header Action Buttons --- */
.header-action-buttons {
    display: flex;
    gap: 10px; /* Space between buttons */
    flex-shrink: 0;
}

.header-action-btn {
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 8px; /* Curved box */
    padding: 8px 15px; /* Adjust padding as needed */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 80px; /* Ensure buttons have some minimum width */
    text-align: center;
}

.header-action-btn:hover {
    background-color: #005bb5; /* Darker shade on hover */
}

.header-action-btn img {
    width: 28px; /* Adjust icon size */
    height: 28px;
    margin-bottom: 4px; /* Space between icon and text */
}

.header-action-btn span {
    font-size: 0.8rem; /* Adjust text size */
    font-weight: 500;
    line-height: 1.2;
}


/* --- Old Account Actions - Keep hidden for reference or remove if sure --- */
.account-actions {
   display: none; /* Hide the old button container */
}


/* Contener #3 - Footer */
.container-footer {
  text-align: center;
  padding-top: 20px;
  padding-bottom: 20px;
  background-color: #f8f9fa;
  border-top: 1px solid var(--border-color);
  max-width: 1200px;
}

/* --- NEW RESPONSIVE HEADER STYLES --- */
.hamburger-menu-btn { /* This was misnamed, it's actually the main menu button */
    display: flex; /* Always display the new menu button */
    /* Styles are now handled by .header-action-btn */
}
/* Slide-out menu styles remain largely the same, but ensure trigger ID is correct in JS */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -300px; /* Start off-screen */
    width: 300px;
    height: 100%;
    background: linear-gradient(160deg, #1e3a8a, #2c3e50);
    z-index: 1002;
    transition: left 0.3s ease-in-out;
    box-shadow: 2px 0 15px rgba(0,0,0,0.3);
    color: white;
}
.mobile-nav.open {
    left: 0;
}
.mobile-nav-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.mobile-nav-overlay.open {
    opacity: 1;
    visibility: visible;
}
.mobile-nav-close {
    position: absolute;
    top: 15px; right: 15px;
    font-size: 2.5rem;
    color: white;
    background: none; border: none; cursor: pointer;
    line-height: 1;
}
.mobile-nav-content {
    padding-top: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.mobile-nav-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mobile-nav-header .icon-bg {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-nav-header .icon-bg svg { width: 32px; height: 32px; }
.mobile-nav-header h3 { font-size: 1.5rem; margin: 0; color: white; }

.mobile-nav-scroll {
    overflow-y: auto;
    flex-grow: 1;
    padding: 10px 20px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 10px;
    text-decoration: none;
    color: #e0e0e0;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
}
.mobile-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.mobile-nav-item svg { width: 22px; height: 22px; }

/* Styles for accordion menu items */
.accordion .accordion-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
}
.accordion.active .accordion-arrow {
    transform: rotate(90deg);
}
.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 20px;
    background-color: rgba(0,0,0,0.2);
    border-radius: 0 0 8px 8px;
}
.sub-item {
    font-size: 0.95rem !important;
    padding-left: 37px !important; /* Align with text of parent */
}
/* Logout button specific style */
.mobile-logout-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 20px auto;
    padding: 15px;
    text-align: center;
    background-color: transparent;
    border: 1px solid white;
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* --- Adjustments for smaller screens --- */
@media (max-width: 768px) {
    .container-header {
        padding: 0 10px; /* Reduce padding on mobile */
    }
    .top-header {
        padding: 8px 0; /* Reduce vertical padding */
        gap: 8px; /* Reduce gap */
    }
    .logo img {
        max-height: 35px; /* Smaller logo */
    }
    .search-bar {
       max-width: none; /* Allow search to take available space */
       flex-grow: 1;
    }
    .search-bar input {
        padding: 10px 45px 10px 15px;
        font-size: 0.9rem;
    }
     .search-bar button {
        width: 32px;
        height: 32px;
     }
     .search-bar button svg {
        width: 18px;
        height: 18px;
     }

    .header-action-buttons {
        gap: 5px; /* Smaller gap */
    }
    .header-action-btn {
        min-width: 60px; /* Smaller min-width */
        padding: 5px 8px;
    }
    .header-action-btn img {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }
     .header-action-btn span {
        font-size: 0.7rem;
     }
}

/* --- Pagination Styles --- */
.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination button {
    color: var(--primary-color);
    padding: 8px 16px;
    text-decoration: none;
    transition: background-color .3s;
    border: 1px solid var(--border-color);
    margin: 0 4px;
    cursor: pointer;
    background-color: white;
    border-radius: 5px;
    font-size: 0.9rem;
}

.pagination button:hover:not(.active):not(:disabled) {
    background-color: #f0f0f0;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: bold;
}

.pagination button:disabled {
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
}

/* --- Open Tickets Notification Bar --- */
.open-tickets-bar-wrapper {
    max-width: 1200px; /* Match other containers */
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 1rem 20px;
    margin-top: -20px;
    /* Background color removed - let the container's bg show */
    box-sizing: border-box; /* Ensures padding is included in width */
}

.open-tickets-bar {
    max-width: 350px;
    margin: 0 auto; /* This centers the bar within the wrapper */
    background-color: #e6a72c;
    color: #22354e;
    border: none;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.open-tickets-bar:hover {
    background-color: #d19627;
}

.open-tickets-content {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.icon-and-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.ticket-icon {
   display: none;
}

.ticket-count {
    background-color: #22354e;
    color: white;
    font-weight: 700;
    font-size: 0.9em;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.view-tickets-btn {
    display: none;
}

@media (max-width: 1240px) { /* Corresponds to 1200px + padding */
    .open-tickets-bar-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 768px) {
    .open-tickets-bar-wrapper {
        padding: 0.75rem 10px; /* Reduced padding */
        margin-top: -10px; /* Adjust spacing */
    }
    .open-tickets-bar {
        border-radius: 0 0 12px 12px;
        max-width: 300px; /* Slightly narrower */
    }
    .open-tickets-content {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        text-align: center;
    }
     .icon-and-text {
        font-size: 0.9rem; /* Slightly smaller text */
     }
}