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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: rgb(15, 23, 42);
    background-image: radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.15) 0, transparent 50%),
                    radial-gradient(at 80% 0%, rgba(59, 130, 246, 0.15) 0, transparent 50%),
                    radial-gradient(at 0% 50%, rgba(168, 85, 247, 0.1) 0, transparent 50%),
                    radial-gradient(at 80% 50%, rgba(34, 211, 238, 0.15) 0, transparent 50%),
                    radial-gradient(at 0% 100%, rgba(147, 51, 234, 0.1) 0, transparent 50%),
                    radial-gradient(at 80% 100%, rgba(16, 185, 129, 0.1) 0, transparent 50%);
    animation: meshMove 20s ease-in-out infinite;
    min-height: 100vh;
    color: rgb(226, 232, 240);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

@keyframes meshMove {
    0%, 100% {
        background-position: 0% 0%, 100% 0%, 0% 50%, 100% 50%, 0% 100%, 100% 100%;
    }
    50% {
        background-position: 100% 100%, 0% 100%, 100% 50%, 0% 50%, 100% 0%, 0% 0%;
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.navbar ul {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.navbar li {
    margin: 0;
}

.navbar a {
    display: block;
    color: rgb(226, 232, 240);
    text-decoration: none;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.navbar a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, rgb(59, 130, 246), rgb(99, 102, 241));
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.navbar a:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: rgb(147, 197, 253);
}

.navbar a:hover::after {
    width: 80%;
}

/* Banner */
.banner {
    display: flex;
    align-items: center;
    padding: 2rem 2rem;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    gap: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    animation: slideDown 0.6s ease-out;
}

.banner img {
    height: 4rem;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.banner h1 {
    margin: 0;
    font-size: 2.5rem;
    color: rgb(226, 232, 240);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Container */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    animation: fadeInUp 0.6s ease-out;
    border: 1px solid rgba(71, 85, 105, 0.3);
    transition: all 0.3s ease;
}

.container:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15),
                0 4px 6px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.content {
    padding: 1rem 0;
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: rgb(226, 232, 240);
    margin-top: 0.5rem;
    font-weight: 700;
}

/* Messages */
.message {
    text-align: center;
    color: rgb(148, 163, 184);
    margin-bottom: 1.5rem;
}

.error-message {
    text-align: center;
    color: rgb(252, 165, 165);
    background: rgba(239, 68, 68, 0.1);
    backdrop-filter: blur(8px);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.info-message {
    text-align: center;
    color: rgb(147, 197, 253);
    background: rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(8px);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: rgb(203, 213, 225);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    font-size: 1rem;
    color: rgb(226, 232, 240);
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: rgb(100, 116, 139);
}

.form-input:focus {
    outline: none;
    border-color: rgb(59, 130, 246);
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1),
                0 4px 12px rgba(59, 130, 246, 0.2);
}

.form-button {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgb(59, 130, 246) 0%, rgb(99, 102, 241) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.form-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.form-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.form-button:hover::before {
    width: 300px;
    height: 300px;
}

.form-button:active {
    transform: translateY(0);
}

/* User Info */
.user-info, .guest-info {
    padding: 1.5rem;
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    margin-top: 1.5rem;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.user-info p, .guest-info p {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: rgb(203, 213, 225);
}

.user-info p:last-child {
    margin-bottom: 0;
}

.user-info strong {
    color: rgb(147, 197, 253);
}

/* Home Actions */
.home-actions {
    margin-top: 2rem;
    text-align: center;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, rgb(239, 68, 68) 0%, rgb(220, 38, 38) 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.logout-button:active {
    transform: translateY(0);
}

.guest-info a {
    color: rgb(147, 197, 253);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.guest-info a:hover {
    color: rgb(96, 165, 250);
    text-decoration: underline;
}

/* Profile */
.profile-content {
    margin-top: 2rem;
}

.profile-content h2 {
    color: rgb(226, 232, 240);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgb(59, 130, 246);
    font-weight: 700;
}

.profile-details {
    margin-bottom: 2rem;
}

.detail-row {
    display: flex;
    padding: 1rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    transition: background-color 0.3s ease;
}

.detail-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    font-weight: 600;
    color: rgb(203, 213, 225);
    min-width: 150px;
}

.detail-row span {
    color: rgb(148, 163, 184);
}

.profile-actions {
    margin-top: 2rem;
}

.profile-actions .form-button {
    max-width: 200px;
}

/* Footer */
footer {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    color: rgb(203, 213, 225);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    border-top: 1px solid rgba(71, 85, 105, 0.3);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

footer p {
    margin: 0;
}

/* Organization Hierarchy */
.organization-hierarchy {
    margin-top: 2rem;
}

.hierarchy-title {
    text-align: center;
    color: rgb(226, 232, 240);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hierarchy-subtitle {
    text-align: center;
    color: rgb(148, 163, 184);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.poles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pole-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(71, 85, 105, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.pole-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pole-color-1, rgb(59, 130, 246)), var(--pole-color-2, rgb(99, 102, 241)));
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.pole-card:hover::before {
    transform: scaleX(1);
}

.pole-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.pole-card[data-pole="direction"] {
    --pole-color-1: rgb(99, 102, 241);
    --pole-color-2: rgb(139, 92, 246);
}

.pole-card[data-pole="commercial"] {
    --pole-color-1: rgb(59, 130, 246);
    --pole-color-2: rgb(99, 102, 241);
}

.pole-card[data-pole="finance"] {
    --pole-color-1: rgb(16, 185, 129);
    --pole-color-2: rgb(34, 211, 238);
}

.pole-card[data-pole="operations"] {
    --pole-color-1: rgb(168, 85, 247);
    --pole-color-2: rgb(147, 51, 234);
}

.pole-card[data-pole="risques"] {
    --pole-color-1: rgb(239, 68, 68);
    --pole-color-2: rgb(251, 146, 60);
}

.pole-card[data-pole="support"] {
    --pole-color-1: rgb(245, 158, 11);
    --pole-color-2: rgb(251, 191, 36);
}

.pole-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.pole-header.collapsible {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.pole-header.collapsible:hover {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    padding: 0.75rem;
    margin: -0.75rem;
    margin-bottom: 0.25rem;
}

.pole-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.pole-header h3 {
    color: rgb(226, 232, 240);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.pole-departments {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pole-departments.collapsed {
    display: none;
    opacity: 0;
}

.pole-departments.expanded {
    display: flex;
    opacity: 1;
    animation: slideDown 0.3s ease-out;
}

.department {
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    color: rgb(203, 213, 225);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(71, 85, 105, 0.2);
    cursor: pointer;
    margin-top: 0.5rem;
}

.department.level-3 {
    margin-left: 0;
    border-left: 3px solid rgba(59, 130, 246, 0.3);
}

.department:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(4px);
    color: rgb(147, 197, 253);
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-left: 1.5rem;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(71, 85, 105, 0.2);
}

.service {
    padding: 0.6rem 1rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 10px;
    color: rgb(148, 163, 184);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(71, 85, 105, 0.15);
    cursor: pointer;
}

.service.level-4 {
    margin-left: 0;
}

.service:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(6px);
    color: rgb(167, 139, 250);
}

/* Collapsible Sections */
.department.collapsible {
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.department.collapsible:hover {
    cursor: pointer;
}

.toggle-icon {
    font-size: 0.8rem;
    color: rgb(148, 163, 184);
    margin-left: auto;
    transition: transform 0.3s ease, color 0.3s ease;
    display: inline-block;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
    color: rgb(147, 197, 253);
}

.services-list.collapsed {
    display: none;
    opacity: 0;
}

.services-list.expanded {
    display: flex;
    opacity: 1;
    animation: slideDown 0.3s ease-out;
}

/* Hierarchy Controls */
.hierarchy-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.hierarchy-control-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgb(59, 130, 246) 0%, rgb(99, 102, 241) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.hierarchy-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.hierarchy-control-btn:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .banner {
        padding: 1.5rem 1rem;
    }

    .banner h1 {
        font-size: 1.8rem;
    }

    .banner img {
        height: 3rem;
    }

    .navbar a {
        padding: 0.75rem 1rem;
    }

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

    .hierarchy-title {
        font-size: 1.5rem;
    }

    .hierarchy-subtitle {
        font-size: 0.95rem;
    }
}
