/* Dashboard Module Layout */
:root {
    --sidebar-width: 240px;
    --header-height: 60px;
}

/* Layout Elements */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap; /* 回り込みを禁止 */
    background-color: var(--primary-color);
    height: var(--header-height);
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 2000;
}

.header-logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    height: 100%;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
    gap: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.logo-link:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.header-brand-logo {
    height: 32px;
    width: 32px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.app-header h1 {
    margin: 0;
    padding: 0;
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 800;
    display: flex;
    align-items: center;
}

/* Hamburger Menu Button */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2100;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Hamburger Active Animation */
.sidebar-open .hamburger-menu span:first-child {
    transform: rotate(45deg);
}

.sidebar-open .hamburger-menu span:nth-child(2) {
    opacity: 0;
}

.sidebar-open .hamburger-menu span:nth-child(3) {
    transform: rotate(-45deg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-open {
    overflow: hidden;
}

.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    height: 100%;
}

.logout-form {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    height: 100%;
}

.user-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.app-container {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

.main-content {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    min-width: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.sidebar-inner {
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

.menu-label {
    font-weight: bold;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.menu-label.admin {
    border-bottom-color: #ffcccc;
    margin-top: 25px;
}

.sidebar-user-mobile {
    display: none;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 20px;
    color: var(--text-main);
    border-left: 4px solid var(--primary-color);
}

.sidebar-user-mobile .user-info {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

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

.menu-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item:hover {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-left: 20px;
}

.menu-item.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 220, 87, 0.2);
}

.menu-item.admin:hover {
    background-color: #fff5f5;
    color: #c53030;
}

.menu-item.admin.active {
    background-color: #feb2b2;
    color: #9b2c2c;
    box-shadow: 0 4px 6px rgba(254, 178, 178, 0.2);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.app-footer a {
    color: var(--text-light);
}

/* Feature Specific: Dashboard Home Service Grid */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.service-card {
    background: #f7fafc;
    padding: 25px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: white;
    border-color: var(--primary-color);
}

.service-icon {
    font-size: 2rem;
    margin-bottom: 15px;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .app-container {
        padding: 15px;
        gap: 15px;
    }
}

@media (max-width: 991px) {
    .hamburger-menu {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1600;
        transition: left 0.3s ease;
        margin: 0;
        overflow-y: auto;
    }

    .sidebar-inner {
        height: 100%;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border-color);
        box-shadow: var(--shadow-xl);
        padding: calc(var(--header-height) + 20px) 20px 20px;
        position: static;
    }

    .sidebar-open .sidebar {
        left: 0;
    }

    .sidebar-user-mobile {
        display: block;
    }

    .main-content {
        padding: 20px;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .desktop-only {
        display: none !important;
    }

    .app-header {
        padding: 0 15px;
    }
    
    .app-header h1 {
        font-size: 1.25rem;
        white-space: nowrap;
    }

    .header-logo-group {
        margin: 0;
    }

    .app-footer {
        padding: 20px 10px;
    }

    .main-content {
        padding: 15px;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
}
