/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Changed from min-height to height */
    overflow: hidden; /* Prevent body scroll */
}

body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header styles */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background-color: white;
    width: 100%;
    border-bottom: 1px solid #ddd;
}

.logo-header {
    text-align: left;
}

.logo-header img {
    height: 50px;
}

.logout-button {
    background-color: transparent;
    border: 1px solid #2980b9;
    color: #2980b9;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-button:hover {
    background-color: #2980b9;
    color: white;
}

.content-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px); /* 60px is your header height */
    overflow: hidden; /* Prevent container overflow */
    position: relative;
}


.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.menu-category {
    border-bottom: 1px solid #e0e0e0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    cursor: pointer;
    font-weight: bold;
    align-items: center;
}

.menu-header:hover {
    background-color: #e8e8e8;
}

.menu-header.active {
    background-color: #e0e0e0;
    color: #2980b9;
}

.menu-header::after {
    content: "▼";
    font-size: 10px;
    transition: transform 0.3s;
}

.menu-header.collapsed::after {
    transform: rotate(-90deg);
}

.submenu {
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out;
}

.submenu.collapsed {
    max-height: 0;
}

.submenu-item {
    padding: 10px 10px 10px 30px;
    cursor: pointer;
}

.submenu-item:hover, .submenu-item.active {
    background-color: #e0e0e0;
}

.submenu-item.active {
    color: #2980b9;
    font-weight: bold;
}

/* Main content styles */
.main-content {
    flex: 1;
    padding: 0;
    background-color: #fff;
    overflow-x: hidden;
    overflow-y: auto; /* Add vertical scroll for main content */
    height: 100%; /* Take full height of parent */
    margin-left: 60px;
}

.breadcrumb {
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
}

.breadcrumb a {
    color: #2980b9;
    text-decoration: none;
}

.breadcrumb span {
    color: #555;
}

/* Tab navigation */
.tab-navigation {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
    overflow-x: auto; /* Allow horizontal scrolling if tabs overflow */
    white-space: nowrap; /* Keep tabs on one line */
}

.tab {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    display: inline-block; /* Ensure tabs stay on one line */
}

.tab:hover {
    background-color: #f5f5f5;
}

.tab.active {
    border-bottom: 3px solid #2980b9;
    color: #2980b9;
    font-weight: bold;
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    width: 100%;
}

.card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%; /* Ensure all cards in a row have the same height */
    background-color: white;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.card-icon {
    width: 40px;
    height: 40px;
    background-color: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.card-title {
    font-weight: bold;
    font-size: 16px;
}

.card-content {
    flex: 1; /* Take available space */
}

.card-content ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.card-content li {
    margin-bottom: 8px;
    font-size: 14px;
}

.card-button {
    margin-top: auto; /* Push to bottom */
    text-align: center;
}

.prompt-button {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    display: inline-block;
    transition: all 0.2s;
}

.prompt-button:hover {
    background-color: #2980b9;
    color: white;
    border-color: #2980b9;
}

/* Add button */
.add-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #2980b9;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    z-index: 100;
    transition: transform 0.2s;
}

.add-button:hover {
    background-color: #3498db;
    transform: scale(1.1);
}

/* Table styles */
.content-area {
    padding: 20px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-title {
    font-size: 18px;
    font-weight: bold;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Prevent column width changes */
}

.data-table th {
    text-align: left;
    padding: 12px 15px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f5f5f5;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tr:hover {
    background-color: #f9f9f9;
}

.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.page-info {
    display: flex;
    align-items: center;
}

.page-info select {
    margin: 0 10px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pagination {
    margin-left: 20px;
    color: #555;
}

.action-button {
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid;
    display: inline-block;
    text-align: center;
    transition: all 0.2s;
}

.show-button {
    background-color: #2980b9;
    color: white;
    border-color: #2980b9;
}

.show-button:hover {
    background-color: #3498db;
}

.delete-button {
    background-color: #7f8c8d;
    color: white;
    border-color: #7f8c8d;
}

.delete-button:hover {
    background-color: #95a5a6;
}

.text-center {
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .content-container {
        flex-direction: row; /* Keep row to maintain sidebar position */
    }
    
    .sidebar {
        flex-shrink: 0; /* Prevent sidebar from shrinking */
    }
    
    .main-content {
        flex: 1;
        min-width: 0; /* Prevent overflow */
    }
    
    .card-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    /* Make table responsive */
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}




/* Neue Sidebar-Styles */
.sidebar {
    width: 60px;
    background-color: #f5f5f5;
    color: #333;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 100;
}

.sidebar:hover {
    width: 250px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    z-index: 500;
}

/* Reset for builder-sidebar (workflow builder uses class="sidebar builder-sidebar") */
.sidebar.builder-sidebar {
    position: relative;
    width: 280px;
    z-index: auto;
    top: auto;
    left: auto;
    margin-left: 0;
}

.sidebar.builder-sidebar:hover {
    width: 280px;
    box-shadow: none;
}

/* Ensure builder-sidebar text is always visible */
.sidebar.builder-sidebar .dept-name,
.sidebar.builder-sidebar .menu-text,
.sidebar.builder-sidebar .dashboard-text,
.sidebar.builder-sidebar .submenu-text,
.sidebar.builder-sidebar .menu-group {
    opacity: 1;
    width: auto;
    pointer-events: auto;
    overflow: visible;
    height: auto;
}

/* Hide text elements by default, show on hover */
.sidebar .dept-name,
.sidebar .menu-text,
.sidebar .dept-dropdown-icon,
.sidebar .dashboard-text,
.sidebar .submenu-text {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.15s ease;
    pointer-events: none;
    overflow: hidden;
    width: 0;
}

.sidebar:hover .dept-name,
.sidebar:hover .menu-text,
.sidebar:hover .dept-dropdown-icon,
.sidebar:hover .dashboard-text,
.sidebar:hover .submenu-text {
    opacity: 1;
    pointer-events: auto;
    width: auto;
}

.sidebar .menu-group {
    opacity: 0;
    height: 0;
    padding: 0 15px;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.15s ease, height 0.25s ease, padding 0.25s ease, margin 0.25s ease;
}

.sidebar:hover .menu-group {
    opacity: 1;
    height: auto;
    padding: 12px 15px;
    margin-top: 10px;
}

/* Dashboard-Menüpunkt */
.dashboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s;
    position: relative;
    justify-content: center;
}

.sidebar:hover .dashboard-item {
    justify-content: flex-start;
}

.dashboard-item:hover {
    background-color: #e8e8e8;
}

.dashboard-item.active {
    background-color: #e0e0e0;
    color: #2980b9;
    font-weight: bold;
}

.dashboard-icon {
    width: 24px;
    text-align: center;
    margin-right: 0;
    flex-shrink: 0;
}

.sidebar:hover .dashboard-icon {
    margin-right: 12px;
}

/* Department Selector */
.department-selector {
    position: relative;
    border-bottom: 1px solid #ddd;
}

.current-department {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    background-color: #2980b9;
    color: white;
    justify-content: center;
}

.sidebar:hover .current-department {
    justify-content: flex-start;
}

.dept-icon {
    width: 24px;
    text-align: center;
    margin-right: 0;
    flex-shrink: 0;
}

.sidebar:hover .dept-icon {
    margin-right: 12px;
}

.dept-name {
    flex: 1;
    font-weight: bold;
}

/* Prevent dropdown in compact mode */
.sidebar:not(:hover) .departments-dropdown {
    display: none;
}

.dept-dropdown-icon {
    font-size: 12px;
}

/* Dropdown für Abteilungen */
.departments-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}

.departments-dropdown.open {
    max-height: 70vh; /* Begrenzte Höhe mit Scrolling */
    overflow-y: auto;
}

.department-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.department-option:hover {
    background-color: #f0f0f0;
}

.department-option.active {
    background-color: #e0f0ff;
    color: #2980b9;
}

/* Menü für aktuelle Abteilung */
.department-menu {
    margin-top: 10px;
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    position: relative;
    justify-content: center;
}

.sidebar:hover .submenu-item {
    justify-content: flex-start;
    padding-left: 20px;
}

.submenu-item:hover {
    background-color: #e8e8e8;
}

.submenu-item.active {
    background-color: #e0e0e0;
    color: #2980b9;
    font-weight: bold;
}

.submenu-icon {
    width: 20px;
    text-align: center;
    margin-right: 0;
    color: #555;
    flex-shrink: 0;
}

.sidebar:hover .submenu-icon {
    margin-right: 12px;
}

.submenu-item.active .submenu-icon {
    color: #2980b9;
}

/* Weitere Menügruppen */
.menu-group {
    font-size: 12px;
    font-weight: bold;
    color: #777;
    background-color: #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    position: relative;
    justify-content: center;
}

.sidebar:hover .menu-item {
    justify-content: flex-start;
}

.menu-item:hover {
    background-color: #e8e8e8;
}

.menu-item.active {
    background-color: #e0e0e0;
    color: #2980b9;
}

.menu-icon {
    width: 20px;
    text-align: center;
    margin-right: 0;
    color: #555;
    flex-shrink: 0;
}

.sidebar:hover .menu-icon {
    margin-right: 12px;
}

/* Unsichtbarer kompletter Link */
.full-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Toggle für kompaktes Menü */
.toggle-sidebar {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background-color: #2980b9;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.toggle-sidebar:hover {
    transform: scale(1.1);
}

/* Mobile sidebar toggle button */
.mobile-sidebar-toggle {
    position: fixed;
    top: 70px;
    left: 10px;
    width: 40px;
    height: 40px;
    background-color: #2980b9;
    color: white;
    border: none;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.mobile-sidebar-toggle:hover {
    background-color: #3498db;
    transform: scale(1.05);
}

.mobile-sidebar-toggle.active {
    background-color: #e74c3c;
}

.mobile-sidebar-toggle i {
    font-size: 18px;
}

@media (max-width: 768px) {
    .mobile-sidebar-toggle {
        display: flex;
    }
    
    /* Hide the old toggle button on mobile */
    .toggle-sidebar {
        display: none;
    }
}

/* Hover-Tooltips im kompakten Modus (Standard) */
.sidebar:not(:hover) .menu-item,
.sidebar:not(:hover) .submenu-item,
.sidebar:not(:hover) .dashboard-item {
    position: relative;
}

.menu-item .menu-text,
.submenu-item .submenu-text,
.dashboard-item .dashboard-text {
    position: relative;
}

/* Tooltip für kompakten Modus */
.sidebar:not(:hover) .menu-item:hover::after,
.sidebar:not(:hover) .submenu-item:hover::after,
.sidebar:not(:hover) .dashboard-item:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #333;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar:not(:hover) .current-department:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #333;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Responsive adjustments für kompakte Sidebar */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        position: absolute;
        z-index: 100;
        transition: all 0.3s ease;
        height: 100%;
    }
    
    /* Disable hover expand on mobile */
    .sidebar:hover {
        width: 60px;
        box-shadow: none;
    }
    
    .sidebar:hover .dept-name,
    .sidebar:hover .menu-text,
    .sidebar:hover .dept-dropdown-icon,
    .sidebar:hover .dashboard-text,
    .sidebar:hover .submenu-text,
    .sidebar:hover .menu-group {
        opacity: 0;
        pointer-events: none;
        width: 0;
        height: 0;
        padding: 0 15px;
        margin: 0;
    }
    
    .sidebar:hover .dashboard-item,
    .sidebar:hover .submenu-item,
    .sidebar:hover .menu-item {
        justify-content: center;
    }
    
    .sidebar:hover .current-department {
        justify-content: center;
    }
    
    .sidebar:hover .dashboard-icon,
    .sidebar:hover .dept-icon,
    .sidebar:hover .submenu-icon,
    .sidebar:hover .menu-icon {
        margin-right: 0;
    }
    
    .sidebar.expanded {
        width: 250px;
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        height: calc(100vh - 60px);
        z-index: 1001;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        overflow-y: auto;
    }
    
    .sidebar.expanded .dept-name,
    .sidebar.expanded .menu-text,
    .sidebar.expanded .dept-dropdown-icon,
    .sidebar.expanded .dashboard-text,
    .sidebar.expanded .submenu-text {
        opacity: 1;
        pointer-events: auto;
        width: auto;
    }
    
    .sidebar.expanded .menu-group {
        opacity: 1;
        height: auto;
        padding: 12px 15px;
        margin-top: 10px;
    }
    
    .sidebar.expanded .dashboard-item,
    .sidebar.expanded .submenu-item,
    .sidebar.expanded .menu-item {
        justify-content: flex-start;
    }
    
    .sidebar.expanded .current-department {
        justify-content: flex-start;
    }
    
    .sidebar.expanded .dashboard-icon,
    .sidebar.expanded .dept-icon,
    .sidebar.expanded .submenu-icon,
    .sidebar.expanded .menu-icon {
        margin-right: 12px;
    }
    
    /* Overlay when sidebar is expanded */
    .sidebar-overlay {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .toggle-sidebar {
        bottom: 70px;
    }
    
    /* Adjust main content when sidebar is collapsed */
    .main-content {
        width: calc(100% - 60px);
        margin-left: 60px;
    }
    
    /* Prevent scrolling when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}


/* Language Switcher Styles */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.language-switcher a {
    color: #666;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.language-switcher a:hover {
    color: #333;
    background-color: #f5f5f5;
}

.language-switcher a.active {
    color: #007bff;
    font-weight: 600;
    background-color: #e3f2fd;
}

.language-switcher span {
    color: #ccc;
    font-weight: 300;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .language-switcher {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
        padding: 10px;
    }
    
    /* Optimize header for mobile */
    .main-header {
        padding: 0 10px;
    }
    
    .logo-header img {
        height: 40px;
    }
}

/* Additional responsive styles for small screens */
@media (max-width: 480px) {
    .main-header {
        flex-wrap: wrap;
        height: auto;
        min-height: 60px;
    }
    
    .breadcrumb {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .tab-navigation {
        font-size: 14px;
    }
    
    .tab {
        padding: 12px 15px;
    }
    
    .add-button {
        width: 45px;
        height: 45px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }
}