/**
 * Styles pour les fonctionnalités avancées de DoucAgro
 */

/* ========== Scanner AR ========== */
.ar-scanner-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.ar-scanner-container video,
.ar-scanner-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

.ar-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.ar-controls button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.ar-controls button:hover {
    background: #fff;
    transform: scale(1.05);
}

.ar-controls button.active {
    background: #2ecc71;
    color: white;
}

.ar-status {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10;
}

/* ========== Assistant Vocal ========== */
.vocal-assistant {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.vocal-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vocal-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.vocal-button.listening {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.vocal-feedback {
    position: absolute;
    bottom: 90px;
    right: 0;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    display: none;
}

.vocal-feedback.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Mode Équipe ========== */
.team-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
}

.team-sidebar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.team-sidebar h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 16px;
}

.online-users-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.online-users-list li {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease;
}

.online-users-list li:hover {
    background: #f8f9fa;
}

.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #95a5a6;
}

.online-indicator.online {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.team-chat {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.team-chat-header {
    padding: 20px;
    border-bottom: 2px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-chat-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.team-chat-header .btn {
    padding: 8px 12px;
}

#team-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.team-message {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    max-width: 80%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.team-message.own-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-header strong {
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: #95a5a6;
}

.team-message.own-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-body {
    font-size: 15px;
    line-height: 1.5;
}

.shared-detection {
    background: #e8f5e9;
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-image {
    max-width: 300px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
}

.team-chat-input {
    padding: 20px;
    border-top: 2px solid #ecf0f1;
    display: flex;
    gap: 10px;
}

.team-chat-input input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ecf0f1;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
}

.team-chat-input input:focus {
    border-color: var(--primary-color);
}

.team-chat-input button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    min-width: 48px;
}

.team-chat-input button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.team-chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.team-chat-input button i {
    pointer-events: none;
}

/* ========== Rapports ========== */
.rapport-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.rapport-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.rapport-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.rapport-actions {
    display: flex;
    gap: 10px;
}

.rapport-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.rapport-stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.rapport-stat-value {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 5px;
}

.rapport-stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== Mode Coach ========== */
.coach-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.coach-main {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.coach-suggestions-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.coach-suggestions-panel h4 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.suggestion-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid #3498db;
    display: flex;
    gap: 15px;
    transition: all 0.3s ease;
}

.suggestion-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.suggestion-item.haute {
    border-left-color: #e74c3c;
    background: #fff5f5;
}

.suggestion-item.normale {
    border-left-color: #f39c12;
    background: #fffaf0;
}

.suggestion-icon {
    font-size: 24px;
    color: var(--primary-color);
}

.suggestion-content {
    flex: 1;
}

.suggestion-content h5 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: var(--text-primary);
}

.suggestion-content p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.risk-score {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    margin-bottom: 20px;
}

.risk-score-value {
    font-size: 48px;
    font-weight: bold;
}

.risk-score-info h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.risk-score-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.calendrier-interventions {
    display: grid;
    gap: 12px;
}

.intervention-item {
    background: white;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.intervention-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.intervention-date {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.intervention-type {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.intervention-type i {
    color: var(--primary-color);
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-info {
    background: #3498db;
    color: white;
}

.badge-danger {
    background: #e74c3c;
    color: white;
}

.badge-success {
    background: #27ae60;
    color: white;
}

.badge-warning {
    background: #f39c12;
    color: white;
}

.badge-secondary {
    background: #95a5a6;
    color: white;
}

/* ========== Content Section ========== */
.content-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.content-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* Form elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Table styling */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ecf0f1;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 40px;
}

.loading i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.empty-state p {
    color: #999;
    margin: 0;
}

/* Error states */
.error-state {
    text-align: center;
    padding: 30px;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.error-state i {
    font-size: 48px;
    color: #e74c3c;
    margin-bottom: 15px;
}

.error-state p {
    color: #c0392b;
    margin: 0;
    font-weight: 500;
}

/* Toast notification */
#toast-notification {
    font-size: 15px;
    font-weight: 500;
}

/* Scroll button */
[id^="btn-scroll-"] {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Message input disabled state */
.team-chat-input input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Typing indicator */
#typing-indicator {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Hover effects for floating buttons */
[style*="position: fixed"] button:hover:not(:disabled) {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

/* ========== Responsive ========== */
@media (max-width: 968px) {
    .team-container {
        grid-template-columns: 1fr;
    }
    
    .team-sidebar {
        display: none;
    }
    
    [style*="position: fixed"][style*="bottom: 100px"] {
        bottom: 80px !important;
        right: 15px !important;
    }
    
    [style*="position: fixed"][style*="bottom: 100px"] button {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
    
    .team-chat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .team-chat-input {
        padding: 15px;
        gap: 8px;
    }
    
    .team-chat-input input {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .team-chat-input button {
        min-width: 44px;
        padding: 10px 15px;
    }
    
    .coach-container {
        grid-template-columns: 1fr;
    }
    
    .coach-suggestions-panel {
        position: static;
    }
    
    .vocal-assistant {
        bottom: 20px;
        right: 20px;
    }
    
    .vocal-button {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .rapport-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rapport-actions {
        flex-wrap: wrap;
    }
    
    .rapport-actions .btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .intervention-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 640px) {
    .rapport-stats {
        grid-template-columns: 1fr;
    }
    
    .rapport-stat-value {
        font-size: 28px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========== Boutons d'action ========== */
.btn-ar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-ar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-vocal {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-vocal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.btn-team {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-team:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.btn-rapport {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-rapport:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 233, 123, 0.4);
}

.btn-coach {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-coach:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background: #1da851;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* Styles pour boutons désactivés */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}
