/**
 * Fichier: assets/css/carnet-adresses.css
 * Styles pour le module Carnet d'adresses
 */

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

.sasprouteau-carnet-adresses {
    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
======================================== */

.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);
    flex-wrap: wrap;
    gap: 1rem;
}

.module-header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.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;
}

/* Statistiques */
.stats-quick {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 0.75rem;
}

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

.stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

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

/* Recherche */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.125rem;
    opacity: 0.5;
}

.search-input {
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    width: 300px;
    transition: all 0.2s;
}

.search-input: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: hidden;
    display: flex;
}

.carnet-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ========================================
   SIDEBAR GROUPES
======================================== */

.groups-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.groups-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.groups-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.05em;
}

.groups-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.group-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    border-radius: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

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

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

.group-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.group-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.group-count {
    min-width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    border-radius: 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.group-item.active .group-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Badges de couleur */
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #e9d5ff; color: #6b21a8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-pink { background: #fce7f3; color: #9f1239; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #e5e7eb; color: #374151; }

.group-delete {
    width: 1.5rem;
    height: 1.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-radius: 0.375rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.group-item:hover .group-delete {
    display: flex;
}

.group-delete:hover {
    background: #dc2626;
    color: white;
}

.groups-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

/* Appels récents */
.recent-calls {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

.btn-call-history {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-call-history:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

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

/* ========================================
   ZONE CONTACTS
======================================== */

.contacts-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.contacts-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.contacts-count {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ========================================
   GRILLE DE CONTACTS
======================================== */

.contacts-grid {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    align-content: start;
}

/* ========================================
   CARTE CONTACT
======================================== */

.contact-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.favorite-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-size: 1.25rem;
    z-index: 2;
    animation: favorite-bounce 0.5s ease-in-out;
}

@keyframes favorite-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Header de la carte */
.contact-card-header {
    position: relative;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2.5rem;
}

.contact-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #e5e7eb center/cover no-repeat;
    position: relative;
    z-index: 1;
}

.contact-favorite {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
}

.contact-favorite:hover {
    transform: scale(1.1);
    background: white;
}

.contact-favorite.is-favorite .favorite-star {
    color: #fbbf24;
}

/* Corps de la carte */
.contact-card-body {
    padding: 2.5rem 1.5rem 1rem;
    text-align: center;
}

.contact-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.contact-role {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.role-administrator {
    background: #e9d5ff;
    color: #6b21a8;
}

.role-salarie {
    background: #d1fae5;
    color: #065f46;
}

.role-client {
    background: #fce7f3;
    color: #9f1239;
}

.role-partenaire {
    background: #fed7aa;
    color: #9a3412;
}

.role-default {
    background: #e5e7eb;
    color: #374151;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-align: left;
}

.info-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.5rem;
}

.info-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer de la carte */
.contact-card-footer {
    display: flex;
    border-top: 1px solid #e5e7eb;
}

.contact-action-quick {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.contact-action-quick:not(:last-child) {
    border-right: 1px solid #e5e7eb;
}

.contact-action-quick:hover {
    background: #f9fafb;
    transform: scale(1.1);
}

/* ========================================
   ÉTATS
======================================== */

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

.spinner {
    font-size: 3rem;
    animation: spin 1s linear infinite;
}

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

.loading-spinner p,
.empty-state p,
.error-state p {
    margin: 1rem 0 0 0;
    color: #6b7280;
    font-size: 1rem;
}

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

/* ========================================
   MODAL DÉTAILS CONTACT
======================================== */

.modal-large .modal-container {
    max-width: 700px;
}

.contact-details-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1rem;
    color: white;
}

.profile-avatar-large {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #e5e7eb center/cover no-repeat;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
}

.profile-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-role {
    margin: 0 0 1rem 0;
    opacity: 0.9;
}

.btn-favorite {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-favorite:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Grille d'informations */
.contact-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.info-item {
    display: flex;
    gap: 1rem;
}

.info-item .info-icon {
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
    min-width: 0;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    display: block;
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 500;
    word-wrap: break-word;
}

.info-link {
    color: #3b82f6;
    text-decoration: none;
}

.info-link:hover {
    text-decoration: underline;
}

/* Actions du contact */
.contact-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.contact-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.contact-action-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

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

.action-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

/* ========================================
   MODAL TÉLÉPHONE
======================================== */

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

.phone-display {
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}

.phone-number {
    width: 100%;
    padding: 0.75rem;
    border: none;
    background: white;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.phone-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.key-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.key-btn:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

.key-btn:active {
    transform: scale(0.95);
}

.key-letters {
    display: block;
    font-size: 0.625rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.phone-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.phone-action-btn {
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    font-size: 1.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

.delete-btn:hover {
    background: #fecaca;
}

.call-btn {
    background: #10b981;
    color: white;
}

.call-btn:hover {
    background: #059669;
    transform: scale(1.1);
}

.recent-calls-list h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.no-calls {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    padding: 2rem;
}

.call-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.call-item:hover {
    background: #f9fafb;
}

.call-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #e5e7eb center/cover no-repeat;
    flex-shrink: 0;
}

.call-info {
    flex: 1;
}

.call-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
}

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

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

@media (max-width: 1200px) {
    .contacts-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .contact-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .carnet-container {
        flex-direction: column;
    }
    
    .groups-sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .module-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats-quick {
        justify-content: space-between;
    }
    
    .search-input {
        width: 100%;
    }
    
    .contacts-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-info-grid {
        grid-template-columns: 1fr;
    }
}