/* Base styles for the login page, kept as is */
body.login-page {
    margin: 0;
    padding: 0;
    background-color: #000;
    font-family: 'Montserrat', sans-serif;
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Animation de fade-in du logo */
.logo-animated {
    width: 100%;
    max-width: 460px;
    height: auto;
    margin-bottom: 35px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.25));
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeInLogo 1s ease-out forwards;
}

@keyframes fadeInLogo {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container {
    background-color: #000; /* fond totalement noir */
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: none;
    width: 100%;
    max-width: 420px;
    text-align: center;
    z-index: 10;
}

.login-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #aaaaaa;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #333;
    border-radius: 10px;
    background-color: #1e1e1e;
    color: #fff;
    font-size: 15px;
    transition: border-color 0.3s, background-color 0.3s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: #FFD700;
    background-color: #252525;
    outline: none;
}

.login-form input[type="submit"] {
    background-color: #000;
    color: #fff;
    padding: 12px 26px;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 20px;
    width: auto;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.login-form input[type="submit"]:hover {
    background-color: #111;
    transform: scale(1.03);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.error-message {
    margin-top: 20px;
    color: #e74c3c;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive for login page */
@media (max-width: 500px) {
    .login-container {
        padding: 30px 20px;
        max-width: 90%;
    }

    .logo-animated {
        max-width: 320px;
    }

    .login-form input[type="text"],
    .login-form input[type="password"] {
        font-size: 14px;
    }

    .login-form input[type="submit"] {
        font-size: 14px;
        padding: 10px 22px;
    }
}

/* --- Styles for index.php (app-page) --- */

body.app-page {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    color: #e0e0e0;
    background-color: #0d0d0d;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background-color: #1a1a1a;
    padding: 15px 30px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-logo img {
    max-height: 40px;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.1));
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn {
    background-color: #2a2a2a;
    color: #fff;
    padding: 8px 18px;
    border: 1px solid #444;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s, border-color 0.3s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background-color: #3a3a3a;
    border-color: #666;
}

.logout-btn {
    /* No specific changes needed */
}

/* User Menu Dropdown */
.user-menu-dropdown {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    background-color: #2a2a2a;
    color: #fff;
    padding: 8px 18px;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.user-menu-btn:hover {
    background-color: #3a3a3a;
    border-color: #666;
}

.user-menu-btn .dropdown-arrow {
    font-size: 0.7em;
    transform: rotate(0deg);
    transition: transform 0.2s ease-in-out;
}

.user-menu-dropdown.show .user-menu-btn .dropdown-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #1a1a1a;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1;
    right: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
    top: calc(100% + 10px);
}

.user-menu-dropdown .dropdown-content a {
    color: #e0e0e0;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
    transition: background-color 0.2s, color 0.2s;
}

.user-menu-dropdown .dropdown-content a:hover {
    background-color: #2a2a2a;
    color: #FFD700;
}

.user-menu-dropdown .dropdown-content.show {
    display: block;
}

.dropdown-item-disabled {
    color: #666;
    padding: 12px 16px;
    display: block;
    font-size: 0.9em;
    cursor: not-allowed;
}

/* Main app layout */
.page-container {
    display: flex;
    flex: 1;
}

.side-menu-wrapper {
    width: 250px;
    background-color: #111;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #222;
}

.side-menu-wrapper .logo {
    margin-bottom: 30px;
    text-align: center;
}

.side-menu-wrapper .logo img {
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.15));
}

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

.side-menu ul li {
    margin-bottom: 10px;
}

.side-menu ul li a {
    display: block;
    padding: 12px 15px;
    color: #ccc;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.95em;
}

.side-menu ul li a:hover,
.side-menu ul li.active > a {
    background-color: #222;
    color: #FFD700;
}

.side-menu .has-submenu > a {
    position: relative;
}

.side-menu .has-submenu > a::after {
    content: '\25B6';
    font-size: 0.7em;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
}

.side-menu .has-submenu.open > a::after {
    transform: translateY(-50%) rotate(90deg);
}

.side-menu .submenu {
    list-style: none;
    padding: 0;
    margin: 5px 0 5px 20px;
    display: none;
    border-left: 2px solid #333;
}

.side-menu .submenu li a {
    padding: 8px 10px;
    font-size: 0.9em;
    color: #bbb;
}

.side-menu .submenu li a:hover {
    background-color: #2c2c2c;
    color: #FFD700;
}


.main-content {
    flex: 1;
    padding: 30px;
    background-color: #141414;
    overflow-y: auto;
}

.main-content h1, .main-content h2 {
    color: #FFD700;
    margin-bottom: 20px;
    font-size: 2em;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.main-content p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.app-footer {
    background-color: #1a1a1a;
    color: #888;
    text-align: center;
    padding: 15px 20px;
    border-top: 1px solid #333;
    font-size: 0.85em;
}

/* Form and Table Styles for Management Pages */
.form-container {
    background-color: #1e1e1e;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid #222;
}

.form-container h2 {
    color: #FFD700;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #aaaaaa;
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group select {
    width: calc(100% - 24px); /* Account for padding and border */
    padding: 12px;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: #252525;
    color: #fff;
    font-size: 15px;
    transition: border-color 0.3s, background-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: #FFD700;
    background-color: #2c2c2c;
    outline: none;
}

input[type="submit"],
.action-button {
    background-color: #000;
    color: #fff;
    padding: 10px 20px;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    text-decoration: none; /* For action-button used as link */
    display: inline-block; /* For action-button used as link */
    margin-right: 10px;
}

input[type="submit"]:hover,
.action-button:hover {
    background-color: #111;
    transform: scale(1.02);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.action-button.edit {
    background-color: #0056b3; /* Blue for edit */
    border-color: #004080;
}
.action-button.edit:hover {
    background-color: #004080;
}
.action-button.archive {
    background-color: #8c0000; /* Red for archive */
    border-color: #660000;
}
.action-button.archive:hover {
    background-color: #660000;
}
.action-button.activate {
    background-color: #006600; /* Green for activate */
    border-color: #004d00;
}
.action-button.activate:hover {
    background-color: #004d00;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #1e1e1e;
    border-radius: 10px;
    overflow: hidden; /* For border-radius on table */
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #2a2a2a;
    color: #e0e0e0;
}

th {
    background-color: #2a2a2a;
    color: #FFD700;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
}

tr:hover {
    background-color: #252525;
}

td .status-active {
    color: #28a745; /* Green */
    font-weight: bold;
}

td .status-archived {
    color: #dc3545; /* Red */
    font-weight: bold;
}

.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive for app layout */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        padding: 15px;
    }

    .user-controls {
        width: 100%;
        justify-content: center;
        margin-top: 15px;
    }

    .page-container {
        flex-direction: column;
    }

    .side-menu-wrapper {
        width: 100%;
        padding: 15px;
        border-right: none;
        border-bottom: 1px solid #222;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    .side-menu-wrapper .logo {
        margin-bottom: 15px;
    }

    .side-menu ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .side-menu ul li {
        margin: 5px 10px;
    }

    .side-menu ul li a {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .side-menu .has-submenu > a::after {
        display: none;
    }

    .side-menu .submenu {
        margin: 5px 0;
        border-left: none;
        width: 100%;
        text-align: center;
    }

    table, th, td {
        display: block; /* Stack table headers and data */
        width: 100%;
        box-sizing: border-box;
    }
    th {
        text-align: center;
        background-color: #333;
    }
    td {
        border-bottom: 1px solid #333;
        text-align: right;
        position: relative;
        padding-left: 50%;
    }
    td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
        color: #FFD700;
    }
    td .action-buttons {
        text-align: right;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 10px 15px;
    }

    .main-content {
        padding: 20px;
    }

    .main-content h1 {
        font-size: 1.5em;
    }

    .user-controls {
        flex-direction: column; /* Stack user menu and logout on very small screens */
        gap: 10px;
    }

    .user-menu-btn, .btn {
        width: 100%;
    }
}