/* static/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4a90a4;
    --primary-dark: #357a8a;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #333;
    --text-light: #666;
    --border: #e1e5eb;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--primary);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
}

.sidebar ul {
    list-style: none;
}

.sidebar li a {
    display: block;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.2s;
}

.sidebar li a:hover,
.sidebar li a.active {
    background: rgba(255,255,255,0.2);
}

.search-box {
    margin-top: auto;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
}

#searchResults {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

#searchResults.active {
    display: block;
}

#searchResults .result-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    color: var(--text);
}

#searchResults .result-item:hover {
    background: var(--bg);
}

/* Main Content */
main {
    margin-left: 250px;
    padding: 30px;
    flex: 1;
}

.section {
    display: block;
}

.section.hidden {
    display: none;
}

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

.section header h2 {
    font-size: 1.8rem;
    color: var(--primary-dark);
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

button:hover {
    background: var(--primary-dark);
}

.back-btn {
    background: transparent;
    color: var(--primary);
    padding: 5px 10px;
    margin-bottom: 20px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.card h3 {
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 5px 0;
}

.card .badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-top: 10px;
}

/* Client Detail */
#client-info {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
}

#client-info h2 {
    color: var(--primary-dark);
    margin-bottom: 15px;
}

#client-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

#client-info .info-item label {
    font-size: 0.8rem;
    color: var(--text-light);
    display: block;
}

#client-info .info-item span {
    font-size: 1rem;
}

.client-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.btn-edit {
    background: var(--warning);
    color: #333;
}

.btn-delete {
    background: var(--danger);
}

/* Animals */
.animals-section, .rdv-section {
    margin-top: 30px;
}

.animals-section h3, .rdv-section h3 {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.animals-section h3 button, .rdv-section h3 button {
    font-size: 0.85rem;
    padding: 5px 15px;
}

#animals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.animal-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
}

.animal-card h4 {
    color: var(--primary-dark);
}

.animal-card .animal-info {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 5px 0;
}

.animal-card .animal-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.animal-card .animal-actions button {
    font-size: 0.8rem;
    padding: 5px 10px;
}

/* RDV */
.rdv-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rdv-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.rdv-date {
    text-align: center;
    padding: 10px 15px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    min-width: 80px;
}

.rdv-date .day {
    font-size: 1.5rem;
    font-weight: bold;
}

.rdv-date .month {
    font-size: 0.85rem;
}

.rdv-date .time {
    font-size: 0.9rem;
    margin-top: 5px;
}

.rdv-info {
    flex: 1;
}

.rdv-info h4 {
    color: var(--primary-dark);
}

.rdv-info .rdv-client {
    color: var(--text-light);
    font-size: 0.9rem;
}

.rdv-info .rdv-motif {
    margin-top: 5px;
}

.rdv-info .rdv-notes {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.9rem;
}

.rdv-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.rdv-status.planifié { background: #e3f2fd; color: #1976d2; }
.rdv-status.terminé { background: #e8f5e9; color: #388e3c; }
.rdv-status.annulé { background: #ffebee; color: #d32f2f; }

.rdv-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rdv-actions button {
    font-size: 0.8rem;
    padding: 8px 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-dark);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal form input,
.modal form select,
.modal form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.modal form .form-row {
    display: flex;
    gap: 15px;
}

.modal form .form-row input,
.modal form .form-row select {
    flex: 1;
}

.modal form button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    main {
        margin-left: 0;
    }
    
    .rdv-card {
        flex-direction: column;
    }
}
