/**
 * Fichier: assets/css/ressources.css
 * Styles pour le module Ressources (Post-its)
 */

/* ========================================
   MODULE CONTAINER
======================================== */

.sasprouteau-ressources {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #f8fafc);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header du module */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.module-header-left,
.module-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.module-icon {
    font-size: 1.75rem;
}

/* Contrôles de tri */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.sort-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    background-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-select:hover {
    border-color: #9ca3af;
}

.sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ========================================
   CONTENU PRINCIPAL
======================================== */

.module-content {
    flex: 1;
    overflow: auto;
    padding: 2rem;
}

.postits-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   COLONNES
======================================== */

.postits-column {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.admin-postits-column .column-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.column-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.column-icon {
    font-size: 1.25rem;
}

/* Badge compteur */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-admin {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   GRILLE DE POST-ITS
======================================== */

.postits-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
    min-height: 300px;
}

/* ========================================
   CARTE POST-IT
======================================== */

.postit-card {
    position: relative;
    background: #fef3c7; /* yellow par défaut */
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 180px;
}

.postit-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Épinglé */
.postit-card.pinned {
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.pinned-badge {
    position: absolute;
    top: -8px;
    left: 12px;
    font-size: 1.25rem;
    animation: pin-bounce 0.5s ease-in-out;
}

@keyframes pin-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Couleurs */
.postit-color-yellow { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #92400e; }
.postit-color-blue { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); color: #1e40af; }
.postit-color-green { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); color: #065f46; }
.postit-color-pink { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); color: #9f1239; }
.postit-color-orange { background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%); color: #9a3412; }
.postit-color-purple { background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%); color: #6b21a8; }
.postit-color-red { background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%); color: #991b1b; }
.postit-color-teal { background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%); color: #115e59; }

/* ========================================
   ACTIONS POST-IT
======================================== */

.postit-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.postit-action-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
    color: #4b5563;
}

.postit-action-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Menu déroulant */
.postit-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    overflow: hidden;
    z-index: 10;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #f3f4f6;
}

.menu-item.danger {
    color: #dc2626;
}

.menu-item.danger:hover {
    background: #fee2e2;
}

.menu-icon {
    font-size: 1rem;
}

.menu-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.25rem 0;
}

.menu-info {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}

/* ========================================
   CONTENU POST-IT
======================================== */

.postit-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.postit-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.postit-description {
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
    opacity: 0.9;
}

/* Fichier joint */
.postit-file {
    margin-top: 0.5rem;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.375rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.file-link:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateX(2px);
}

.file-icon {
    font-size: 1rem;
}

.file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   FOOTER POST-IT
======================================== */

.postit-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.postit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    opacity: 0.8;
}

.postit-reminder,
.postit-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================
   ÉTAT VIDE
======================================== */

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0 0 1.5rem 0;
}

/* ========================================
   BOUTONS
======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-icon {
    font-size: 1.125rem;
}

.btn-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   MODAL
======================================== */

.sasprouteau-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-small .modal-container {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #1f2937;
}

.modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* ========================================
   FORMULAIRE
======================================== */

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.form-label.required::after {
    content: ' *';
    color: #dc2626;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1f2937;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ========================================
   COLOR PICKER
======================================== */

.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.color-option input[type="radio"] {
    display: none;
}

.color-swatch {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-option input[type="radio"]:checked + .color-swatch {
    border-color: #1f2937;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-yellow { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
.color-blue { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }
.color-green { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); }
.color-pink { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); }
.color-orange { background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%); }
.color-purple { background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%); }
.color-red { background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%); }
.color-teal { background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%); }

.color-name {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Color picker popup */
.color-picker-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.color-option-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option-btn:hover {
    transform: scale(1.1);
}

.color-option-btn.active {
    border-color: #1f2937;
}

.color-option-btn .color-swatch {
    width: 100%;
    height: 100%;
    border: none;
}

/* ========================================
   UPLOAD FICHIER
======================================== */

.file-upload-wrapper {
    position: relative;
}

.form-control-file {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-label:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.upload-icon {
    font-size: 1.5rem;
}

.upload-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.current-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.remove-file {
    margin-left: auto;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
}

/* ========================================
   NOTIFICATIONS
======================================== */

.sasprouteau-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sasprouteau-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #dc2626;
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-weight: bold;
}

.notification-success .notification-icon {
    color: #10b981;
}

.notification-error .notification-icon {
    color: #dc2626;
}

.notification-info .notification-icon {
    color: #3b82f6;
}

.notification-message {
    font-size: 0.875rem;
    color: #1f2937;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 1024px) {
    .postits-container {
        grid-template-columns: 1fr;
    }
    
    .postits-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .module-header-right {
        width: 100%;
        flex-direction: column;
    }
    
    .sort-controls {
        width: 100%;
    }
    
    .sort-select {
        flex: 1;
    }
    
    .postits-grid {
        grid-template-columns: 1fr;
    }
    
    .color-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .module-content {
        padding: 1rem;
    }
    
    .modal-container {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}