/* ===================================
   TodoSign - CONTACTS PAGE
   Premium Glassmorphism Design
   Using Global Design Tokens
   Accent: Cyan/Indigo (#06b6d4 → #6366f1)
=================================== */

@import url('theme.css');

/* ==================== KEYFRAME ANIMATIONS ==================== */
/* Page-specific animations - others use global */
@keyframes cntAvatarPop {
    0% { transform: translateX(-50%) scale(0.8); }
    60% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); }
}

/* ==================== AMBIENT GLOW EFFECTS ==================== */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
    animation: glowPulse 20s ease-in-out infinite;
}

.ambient-glow-1 {
    top: -200px;
    right: 10%;
    background: linear-gradient(135deg, var(--cyan-500) 0%, var(--indigo-500) 100%);
}

.ambient-glow-2 {
    bottom: -200px;
    left: 10%;
    background: linear-gradient(135deg, var(--indigo-500) 0%, var(--cyan-500) 100%);
    animation-delay: -10s;
}

/* ==================== LAYOUT ==================== */
.container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2.5rem 2.5rem;
    overflow-y: auto;
    font-family: var(--font-body);
}

/* Header styles moved to /css/header.css (Floating Glass Header) */

/* Hero styles moved to /css/hero.css (Glass Card Premium) */

/* ==================== STATS BAR ==================== */
.stats-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease-out 0.1s both;
}

.stat-pill {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-pill:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--glass-border-hover);
}

.stat-pill:hover::before {
    opacity: 1;
}

.stat-pill-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.stat-pill-content {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.stat-pill-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}

.stat-pill-label {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--gray-medium);
    font-weight: 500;
    margin-top: 2px;
}

/* Stat Pill Color Variants - Cyan primary */
.stat-pill-purple .stat-pill-icon,
.stat-pill-cyan .stat-pill-icon {
    background: linear-gradient(135deg, var(--cyan-500-20) 0%, var(--cyan-500-10) 100%);
    color: var(--cyan-500);
    border: 1px solid var(--cyan-500-20);
}

.stat-pill-purple:hover,
.stat-pill-cyan:hover {
    border-color: var(--cyan-500-40);
    background: var(--cyan-500-05);
}

.stat-pill-emerald .stat-pill-icon {
    background: linear-gradient(135deg, var(--emerald-500-20) 0%, var(--emerald-500-10) 100%);
    color: var(--emerald-500);
    border: 1px solid var(--emerald-500-20);
}

.stat-pill-emerald:hover {
    border-color: var(--emerald-500-40);
    background: var(--emerald-500-05);
}

.stat-pill-blue .stat-pill-icon {
    background: linear-gradient(135deg, var(--indigo-500-20) 0%, var(--indigo-500-10) 100%);
    color: var(--indigo-500);
    border: 1px solid var(--indigo-500-20);
}

.stat-pill-blue:hover {
    border-color: var(--indigo-500-40);
    background: var(--indigo-500-05);
}

.stat-pill-amber .stat-pill-icon {
    background: linear-gradient(135deg, var(--amber-500-20) 0%, var(--amber-500-10) 100%);
    color: var(--amber-500);
    border: 1px solid var(--amber-500-20);
}

.stat-pill-amber:hover {
    border-color: var(--amber-500-40);
    background: var(--amber-500-05);
}

/* ==================== ACTION BAR ==================== */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: transparent;
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

/* Filter styles moved to /css/filters.css */

/* Add Contact Button */
.btn-add-contact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px var(--cyan-500-35);
    position: relative;
    overflow: hidden;
}

/* Shimmer effect */
.btn-add-contact::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-add-contact:hover::before {
    left: 100%;
}

.btn-add-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--cyan-500-40);
}

.btn-add-contact i {
    font-size: 1rem;
}

/* Action Bar Right */
.action-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--glass-bg);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.view-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--gray-medium);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.view-btn:hover {
    color: var(--white);
    background: var(--glass-bg-hover);
}

.view-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px var(--cyan-500-40);
}

.hero-actions .view-btn.active {
    background: var(--gradient-primary);
    box-shadow: 0 2px 8px var(--cyan-500-40);
}

/* ==================== CONTACTS GRID ==================== */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Contact Card */
.contact-card {
    background: var(--glass-bg);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
    position: relative;
    height: 280px;
    animation: cardEntrance 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

/* Staggered animation delays */
.contact-card:nth-child(1) { animation-delay: 0.05s; }
.contact-card:nth-child(2) { animation-delay: 0.1s; }
.contact-card:nth-child(3) { animation-delay: 0.15s; }
.contact-card:nth-child(4) { animation-delay: 0.2s; }
.contact-card:nth-child(5) { animation-delay: 0.25s; }
.contact-card:nth-child(6) { animation-delay: 0.3s; }
.contact-card:nth-child(7) { animation-delay: 0.35s; }
.contact-card:nth-child(8) { animation-delay: 0.4s; }
.contact-card:nth-child(9) { animation-delay: 0.45s; }

/* Card Header - Avatar Area */
.contact-header-preview {
    height: 100px;
    background: linear-gradient(135deg, var(--cyan-200) 0%, var(--cyan-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-base);
}

[data-theme="dark"] .contact-header-preview {
    background: linear-gradient(135deg, var(--cyan-900) 0%, var(--cyan-800) 100%);
}

.contact-card:hover {
    transform: translateY(-8px);
    box-shadow:
        var(--shadow-lg),
        0 0 30px var(--cyan-500-15);
    border-color: var(--cyan-500-40);
}

.contact-card:hover .contact-header-preview {
    height: 80px;
    background: linear-gradient(135deg, var(--cyan-700) 0%, var(--indigo-600) 100%);
}

/* Avatar */
.contact-avatar,
.contact-avatar-large {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    border: 4px solid var(--navy-dark);
    box-shadow: 0 4px 12px var(--cyan-500-40);
    position: absolute;
    left: 50%;
    bottom: -35px;
    transform: translateX(-50%);
    transition: all var(--transition-spring);
    z-index: 10;
}

.contact-card:hover .contact-avatar,
.contact-card:hover .contact-avatar-large {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 20px var(--cyan-500-40);
}

/* Card Body */
.contact-body {
    padding: 1.25rem;
    padding-top: 2.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--navy-dark);
    position: relative;
    z-index: 2;
}

.contact-name {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color var(--transition-base);
}

.contact-card:hover .contact-name {
    color: var(--cyan-400);
}

.contact-role {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--gray-medium);
    margin-bottom: 1rem;
}

.contact-info,
.contact-info-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: auto;
}

.contact-info-item,
.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--gray-medium);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.contact-info-item:hover,
.info-item:hover {
    background: var(--cyan-500-10);
    border-color: var(--cyan-500-20);
    color: var(--white);
}

.contact-info-item i,
.info-item i {
    color: var(--cyan-500);
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.contact-info-item span,
.info-item .info-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions Overlay */
.contact-actions-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 5;
}

.contact-card:hover .contact-actions-overlay {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--navy-medium);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background: var(--cyan-500);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--cyan-500-40);
}

.action-btn.delete:hover,
.action-btn.delete-btn:hover {
    background: var(--red-500);
    box-shadow: 0 4px 12px var(--red-500-40);
}

.action-btn.edit-btn:hover {
    background: var(--cyan-500);
    color: white;
}

/* Type Badge */
.contact-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.type-client {
    color: var(--indigo-500);
    border: 1px solid var(--indigo-500-30);
}

.type-partner {
    color: var(--emerald-500);
    border: 1px solid var(--emerald-500-30);
}

.type-internal {
    color: var(--cyan-500);
    border: 1px solid var(--cyan-500-30);
}

/* ==================== LIST VIEW - FLOATING ITEMS ==================== */
.contacts-list-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item-contact {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

/* Stagger list items */
.list-item-contact:nth-child(1) { animation-delay: 0.05s; }
.list-item-contact:nth-child(2) { animation-delay: 0.08s; }
.list-item-contact:nth-child(3) { animation-delay: 0.11s; }
.list-item-contact:nth-child(4) { animation-delay: 0.14s; }
.list-item-contact:nth-child(5) { animation-delay: 0.17s; }
.list-item-contact:nth-child(6) { animation-delay: 0.20s; }
.list-item-contact:nth-child(7) { animation-delay: 0.23s; }
.list-item-contact:nth-child(8) { animation-delay: 0.26s; }
.list-item-contact:nth-child(9) { animation-delay: 0.29s; }
.list-item-contact:nth-child(10) { animation-delay: 0.32s; }

/* Left accent bar */
.list-item-contact::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-base);
}

/* Glow effect */
.list-item-contact::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at left center, var(--cyan-500-06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.list-item-contact:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.list-item-contact:hover::before {
    height: 60%;
}

.list-item-contact:hover::after {
    opacity: 1;
}

/* List Avatar */
.contacts-list-view .list-item-icon {
    position: relative;
    flex-shrink: 0;
}

.contacts-list-view .list-item-icon .avatar-initials {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--gradient-primary);
    border-radius: 50%;
    border: 2px solid var(--cyan-500-20);
    transition: all var(--transition-base);
    font-family: var(--font-display);
}

.list-item-contact:hover .list-item-icon .avatar-initials {
    transform: scale(1.06);
    box-shadow: 0 8px 20px var(--cyan-500-40);
    border-color: var(--cyan-500-40);
}

/* List Content */
.contacts-list-view .list-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contacts-list-view .list-item-name {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--white);
    letter-spacing: -0.01em;
    transition: color var(--transition-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-contact:hover .list-item-name {
    color: var(--cyan-300);
}

.contacts-list-view .list-item-meta {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--gray-medium);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: color var(--transition-base);
}

.contacts-list-view .list-item-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.contacts-list-view .list-item-meta i {
    font-size: 0.75rem;
    color: var(--cyan-500-60);
}

.list-item-contact:hover .list-item-meta {
    color: var(--gray-light);
}

/* List Actions */
.contacts-list-view .list-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-base);
}

.contacts-list-view .list-item-actions .category-badge {
    margin-right: 8px;
}

.contacts-list-view .list-item-actions .action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--gray-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.8rem;
}

.contacts-list-view .list-item-actions .action-btn:hover {
    transform: translateY(-2px) scale(1.05);
}

.contacts-list-view .list-item-actions .edit-btn:hover {
    background: var(--cyan-500-15);
    border-color: var(--cyan-500-40);
    color: var(--cyan-400);
    box-shadow: 0 6px 16px var(--cyan-500-20);
}

.contacts-list-view .list-item-actions .delete-btn:hover {
    background: var(--red-500-15);
    border-color: var(--red-500-40);
    color: #f87171;
    box-shadow: 0 6px 16px var(--red-500-20);
}

/* ==================== CATEGORY BADGES ==================== */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Cliente - Indigo */
.category-badge.category-cliente,
.type-badge.category-cliente {
    background: var(--indigo-500-15);
    color: var(--indigo-500);
    border: 1px solid var(--indigo-500-30);
}

/* Parceiro - Green */
.category-badge.category-parceiro,
.type-badge.category-parceiro {
    background: var(--emerald-500-15);
    color: var(--emerald-500);
    border: 1px solid var(--emerald-500-30);
}

/* Interno - Cyan */
.category-badge.category-interno,
.type-badge.category-interno {
    background: var(--cyan-500-15);
    color: var(--cyan-500);
    border: 1px solid var(--cyan-500-30);
}

/* ==================== LEGACY TABLE VIEW ==================== */
.contacts-list-container {
    display: block !important;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    width: 100%;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

#contacts-view.contacts-list-container {
    display: block !important;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
}

.users-table thead {
    background: var(--glass-bg-hover);
    border-bottom: 1px solid var(--glass-border);
}

.users-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: background var(--transition-fast);
}

.users-table tbody tr:hover {
    background: var(--glass-bg-hover);
}

.users-table tbody tr:last-child {
    border-bottom: none;
}

.users-table td {
    padding: 16px 20px;
    color: var(--white);
    font-size: 0.9rem;
}

.users-table .contact-cell,
.users-table .email-cell,
.users-table .cpf-cell {
    color: var(--gray-medium);
}

.users-table .type-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    background: var(--cyan-500-15);
    color: var(--cyan-500);
    border: 1px solid var(--cyan-500-30);
}

.users-table .type-badge.client {
    background: var(--indigo-500-15);
    color: var(--indigo-500);
    border-color: var(--indigo-500-30);
}

.users-table .type-badge.partner {
    background: var(--emerald-500-15);
    color: var(--emerald-500);
    border-color: var(--emerald-500-30);
}

.users-table .row-checkbox,
.users-table .select-all-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--cyan-500);
    cursor: pointer;
}

.contacts-table-header {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr 120px;
    padding: 16px 24px;
    background: var(--glass-bg-hover);
    border-bottom: 1px solid var(--glass-border);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contacts-table-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr 120px;
    padding: 16px 24px;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.contacts-table-row:hover {
    background: var(--glass-bg-hover);
}

.contacts-table-row:last-child {
    border-bottom: none;
}

.row-contact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.row-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
}

.row-name {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--white);
}

.row-email,
.row-phone {
    font-family: var(--font-body);
    color: var(--gray-medium);
    font-size: 0.9rem;
}

.row-type {
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.contacts-table-row:hover .row-actions {
    opacity: 1;
}

/* ==================== LOADING STATE ==================== */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--gray-medium);
    gap: 1rem;
    text-align: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--cyan-500);
    animation: spin 1s linear infinite;
}

.loading-state p {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--gray-medium);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-medium);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    animation: fadeIn 0.4s ease-out;
}

.empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--cyan-500-15) 0%, var(--cyan-500-05) 100%);
    border: 1px solid var(--cyan-500-20);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon i {
    font-size: 2.5rem;
    color: var(--cyan-500);
}

.empty-state h3 {
    font-family: var(--font-display);
    color: var(--white);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.empty-state p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    max-width: 300px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
}

.empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px var(--cyan-500-40);
}

.empty-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--cyan-500-40);
}

/* ==================== MODALS ==================== */
.modal,
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #fee2e2;
    color: var(--red-500);
}

.modal-header-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--cyan-500-40);
}

.modal-icon i {
    font-size: 1.5rem;
    color: white;
}

.modal-icon-edit {
    background: linear-gradient(135deg, var(--indigo-500) 0%, var(--indigo-600) 100%);
    box-shadow: 0 4px 12px var(--indigo-500-30);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.modal-subtitle {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #64748b;
    margin: 4px 0 0 0;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
}

.form-group label i {
    color: var(--cyan-500);
    font-size: 0.85rem;
}

.modern-input {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    color: #0f172a;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-base);
}

.modern-input:focus {
    background: #ffffff;
    border-color: var(--cyan-500);
    box-shadow: 0 0 0 3px var(--cyan-500-10);
}

.modern-input::placeholder {
    color: #94a3b8;
}

/* Toggle Switch */
.toggle-group {
    margin-top: 0.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #64748b;
}

.toggle-switch {
    width: 52px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-base);
}

.toggle-switch.active {
    background: var(--cyan-500);
}

.toggle-circle {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch.active .toggle-circle {
    left: 26px;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.btn-secondary {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    color: #64748b;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px var(--cyan-500-40);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--cyan-500-40);
}

/* Confirm Modal */
.confirm-content {
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon i {
    font-size: 2rem;
    color: var(--amber-500);
}

.confirm-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
}

.confirm-text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.confirm-no {
    background: #f1f5f9;
    border: none;
    color: #64748b;
}

.confirm-no:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.confirm-yes {
    background: linear-gradient(135deg, var(--red-500) 0%, #dc2626 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px var(--red-500-30);
}

.confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--red-500-40);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .contacts-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.25rem;
    }

    .action-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .btn-add-contact {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .top-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .search-container {
        flex: 1;
        min-width: 200px;
    }

    .hero-welcome {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .floating-decorations {
        display: none;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .stats-bar {
        flex-direction: column;
    }

    .stat-pill {
        min-width: auto;
    }

    .filter-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .contacts-table-header,
    .contacts-table-row {
        grid-template-columns: 2fr 2fr 80px;
    }

    .contacts-table-header span:nth-child(3),
    .contacts-table-header span:nth-child(4),
    .contacts-table-row .row-phone,
    .contacts-table-row .row-type {
        display: none;
    }

    /* List View Mobile */
    .contacts-list-view {
        gap: 10px;
    }

    .list-item-contact {
        padding: 14px 16px;
        gap: 14px;
        border-radius: 14px;
    }

    .contacts-list-view .list-item-icon .avatar-initials {
        width: 42px;
        height: 42px;
        font-size: 0.9rem;
    }

    .contacts-list-view .list-item-name {
        font-size: 0.9rem;
    }

    .contacts-list-view .list-item-meta {
        font-size: 0.78rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .contacts-list-view .list-item-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .contacts-list-view .list-item-actions .action-btn {
        width: 34px;
        height: 34px;
        font-size: 0.75rem;
    }

    .contacts-list-view .list-item-actions .category-badge {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ambient-glow {
        animation: none;
    }

    .floating-doc {
        animation: none;
    }

    .loading-spinner i {
        animation: none;
    }

    .badge {
        animation: none;
    }
}

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] .top-header {
    border-bottom-color: var(--light-border);
}

[data-theme="light"] .breadcrumb-item {
    color: var(--light-text-secondary);
}

[data-theme="light"] .breadcrumb-item.active {
    color: var(--light-text-primary);
}

[data-theme="light"] .search-input {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
    color: var(--light-text-primary);
}

[data-theme="light"] .search-input:focus {
    background: #ffffff;
    border-color: var(--cyan-500);
    box-shadow: 0 0 0 3px var(--cyan-500-10);
}

[data-theme="light"] .search-input::placeholder {
    color: var(--light-text-secondary);
}

[data-theme="light"] .icon-btn,
[data-theme="light"] .theme-toggle {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
    color: var(--light-text-secondary);
}

[data-theme="light"] .icon-btn:hover,
[data-theme="light"] .theme-toggle:hover {
    background: #ffffff;
    border-color: var(--light-border-hover);
    color: var(--light-text-primary);
}

[data-theme="light"] .hero-title {
    background: linear-gradient(135deg, var(--light-text-primary) 0%, var(--cyan-600) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-subtitle {
    color: var(--light-text-secondary);
}

[data-theme="light"] .stat-pill {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .stat-pill:hover {
    background: #ffffff;
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .stat-pill-value {
    color: var(--light-text-primary);
}

[data-theme="light"] .stat-pill-label {
    color: var(--light-text-secondary);
}

[data-theme="light"] .filter-group {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .filter-btn {
    color: var(--light-text-secondary);
}

[data-theme="light"] .filter-btn:hover {
    color: var(--light-text-primary);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .filter-btn.active {
    background: var(--gradient-primary);
    color: white !important;
}

[data-theme="light"] .filter-btn.active i,
[data-theme="light"] .filter-btn.active span {
    color: white !important;
}

[data-theme="light"] .filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.25);
    color: white !important;
}

[data-theme="light"] .view-toggle {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .view-btn {
    color: var(--light-text-secondary);
}

[data-theme="light"] .view-btn:hover {
    color: var(--light-text-primary);
    background: rgba(0, 0, 0, 0.04);
}

/* Light Theme - Contact Cards */
[data-theme="light"] .contact-card {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .contact-card:hover {
    background: #ffffff;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 30px var(--cyan-500-10);
    border-color: var(--cyan-500-30);
}

[data-theme="light"] .contact-body {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .contact-name {
    color: var(--light-text-primary);
}

[data-theme="light"] .contact-card:hover .contact-name {
    color: var(--cyan-700);
}

[data-theme="light"] .contact-role {
    color: var(--light-text-secondary);
}

[data-theme="light"] .contact-avatar,
[data-theme="light"] .contact-avatar-large {
    border-color: #ffffff;
}

[data-theme="light"] .contact-info-item,
[data-theme="light"] .info-item {
    background: rgba(0, 0, 0, 0.03);
    color: var(--light-text-secondary);
}

[data-theme="light"] .contact-info-item:hover,
[data-theme="light"] .info-item:hover {
    background: var(--cyan-500-08);
    border-color: var(--cyan-500-15);
    color: var(--light-text-primary);
}

/* Light Theme - List View */
[data-theme="light"] .list-item-contact {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .list-item-contact:hover {
    background: #ffffff !important;
    border-color: var(--light-border-hover);
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .list-item-contact::after {
    background: radial-gradient(ellipse at left center, var(--cyan-500-05) 0%, transparent 60%);
}

[data-theme="light"] .contacts-list-view .list-item-name {
    color: var(--light-text-primary);
}

[data-theme="light"] .list-item-contact:hover .list-item-name {
    color: var(--cyan-800);
}

[data-theme="light"] .contacts-list-view .list-item-meta {
    color: var(--light-text-secondary);
}

[data-theme="light"] .contacts-list-view .list-item-meta i {
    color: var(--cyan-500);
}

[data-theme="light"] .list-item-contact:hover .list-item-meta {
    color: var(--light-text-primary);
}

[data-theme="light"] .contacts-list-view .list-item-actions .action-btn {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
    color: var(--light-text-secondary);
}

[data-theme="light"] .contacts-list-view .list-item-actions .edit-btn:hover {
    background: var(--cyan-500-10);
    border-color: var(--cyan-500);
    color: var(--cyan-800);
}

[data-theme="light"] .contacts-list-view .list-item-actions .delete-btn:hover {
    background: var(--red-500-10);
    border-color: var(--red-500);
    color: #b91c1c;
}

/* Light Theme - Empty State */
[data-theme="light"] .empty-state {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .empty-state h3 {
    color: var(--light-text-primary);
}

[data-theme="light"] .empty-state p {
    color: var(--light-text-secondary);
}

/* Light Theme - Loading State */
[data-theme="light"] .loading-state {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

/* Light Theme - Table View */
[data-theme="light"] .contacts-list-container {
    background: var(--light-glass-bg);
    border-color: var(--light-border);
}

[data-theme="light"] .users-table thead {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: var(--light-border);
}

[data-theme="light"] .users-table th {
    color: var(--light-text-secondary);
}

[data-theme="light"] .users-table tbody tr {
    border-bottom-color: var(--light-border);
}

[data-theme="light"] .users-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .users-table td {
    color: var(--light-text-primary);
}

[data-theme="light"] .users-table .contact-cell,
[data-theme="light"] .users-table .email-cell,
[data-theme="light"] .users-table .cpf-cell {
    color: var(--light-text-secondary);
}

[data-theme="light"] .contacts-table-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: var(--light-border);
    color: var(--light-text-secondary);
}

[data-theme="light"] .contacts-table-row {
    border-bottom-color: var(--light-border);
}

[data-theme="light"] .contacts-table-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .row-name {
    color: var(--light-text-primary);
}

[data-theme="light"] .row-email,
[data-theme="light"] .row-phone {
    color: var(--light-text-secondary);
}

/* Light Theme - Category Badges */
[data-theme="light"] .category-badge.category-cliente,
[data-theme="light"] .type-badge.category-cliente {
    background: var(--indigo-500-10);
    border-color: var(--indigo-500-20);
}

[data-theme="light"] .category-badge.category-parceiro,
[data-theme="light"] .type-badge.category-parceiro {
    background: var(--emerald-500-10);
    border-color: var(--emerald-500-20);
}

[data-theme="light"] .category-badge.category-interno,
[data-theme="light"] .type-badge.category-interno {
    background: var(--cyan-500-10);
    border-color: var(--cyan-500-20);
}

/* Light Theme - Ambient Glow - Reduced */
[data-theme="light"] .ambient-glow {
    opacity: 0.05;
}
