/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: #FEFEFE;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: #17786F;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo img {
    height: 45px;
    filter: brightness(0) invert(1); /* Blanc pour contraste sur fond vert */
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
    cursor: pointer;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Menu déroulant */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #0d4d47;
    min-width: 180px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    z-index: 1000;
}

.nav-dropdown.active .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: white;
    text-decoration: none;
    transition: background 0.2s;
}

.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.1);
    opacity: 1;
}

/* Contenu principal */
.app-content {
    min-height: calc(100vh - 80px);
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #17786F;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Page de login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #17786F 0%, #0d4d47 100%);
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    text-align: center;
    color: #17786F;
    margin-bottom: 2rem;
}

.login-card img {
    max-width: 200px;
    display: block;
    margin: 0 auto 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: #17786F;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
    min-height: 100px;
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    background: white;
}

.form-group select:focus {
    outline: none;
    border-color: #17786F;
}

.form-group textarea:focus {
    outline: none;
    border-color: #17786F;
}

.form-group p {
    padding: 0.5rem 0;
    color: #333;
    margin: 0;
    min-height: 1.5rem;
}

.form-container h2 {
    color: #17786F;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #333;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Montserrat', sans-serif;
}

.btn-primary {
    background: #17786F;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #0d4d47;
}

.btn-secondary {
    background: #FAB643;
    color: white;
}

.btn-secondary:hover {
    background: #e0a02d;
}

.btn-danger {
    background: #D84F43;
    color: white;
}

.btn-danger:hover {
    background: #c03a2f;
}

/* Pages */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #17786F;
    font-size: 2rem;
}

/* Tableaux */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: #17786F;
    color: white;
}

table th, table td {
    padding: 1rem;
    text-align: left;
}

/* Tableaux actions et mesures dans les rapports */
#actions-table, #mesures-table {
    font-size: 0.9rem;
}

#actions-table thead th, #mesures-table thead th {
    background: #17786F !important;
    color: white !important;
    font-weight: 600;
    padding: 0.75rem;
    border: 1px solid #ddd;
}

#actions-table tbody td, #mesures-table tbody td {
    padding: 0.75rem;
    border: 1px solid #ddd;
    background: #fafafa;
    vertical-align: top;
}

#actions-table tbody td input,
#actions-table tbody td textarea,
#mesures-table tbody td input,
#mesures-table tbody td textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
}

#actions-table tbody td textarea,
#mesures-table tbody td textarea {
    resize: vertical;
    min-height: 60px;
}

#actions-table tbody tr:hover td,
#mesures-table tbody tr:hover td {
    background: #f0f0f0;
}

table tbody tr {
    border-bottom: 1px solid #eee;
}

table tbody tr:hover {
    background: #f5f5f5;
}

/* Formulaires */
.form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row.full {
    grid-template-columns: 1fr;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card h2 {
    color: #17786F;
    margin-bottom: 1rem;
}

.card p {
    color: #666;
    margin-bottom: 1rem;
}

/* Messages */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Modale */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 0;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 900px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.modal-close:hover {
    color: #000;
}

/* Home page */
.home-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.home-hero img {
    max-width: 400px;
    margin-bottom: 2rem;
}

.home-hero h1 {
    color: #17786F;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Footer de formulaire */
.form-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #ddd;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 0 0 8px 8px;
    margin-left: -2rem;
    margin-right: -2rem;
    margin-bottom: -2rem;
}

.form-footer .btn {
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
}

.form-footer .btn-primary {
    background: #17786F;
    color: white;
    width: auto;
}

.form-footer .btn-primary:hover {
    background: #0d4d47;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-footer .btn-secondary {
    background: #FAB643;
    color: white;
    width: auto;
}

.form-footer .btn-secondary:hover {
    background: #e0a02d;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-footer .btn-danger {
    background: #D84F43;
    color: white;
    width: auto;
}

.form-footer .btn-danger:hover {
    background: #c03a2f;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .form-footer {
        flex-direction: column;
        margin-left: -1rem;
        margin-right: -1rem;
    }
    
    .form-footer .btn {
        width: 100%;
    }
}
