/* Connections Page - Modern Styles */

/* Connections Grid */
.connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Connection Card */
.connection-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.connection-card .card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.connection-card:hover .card-glow {
    opacity: 1;
}

.whatsapp-card .card-glow {
    background: linear-gradient(90deg, #25D366 0%, #128C7E 100%);
}

.google-card .card-glow {
    background: linear-gradient(90deg, #4285F4 0%, #34A853 50%, #FBBC05 75%, #EA4335 100%);
}

/* Card Header */
.connection-card-header {
    padding: 1.5rem 1.5rem 0;
}

.connection-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.connection-card:hover .brand-icon {
    transform: scale(1.05);
}

.connection-brand.whatsapp .brand-icon {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
}

.connection-brand.google .brand-icon {
    background: #f8f9fa;
    border: 1px solid var(--border);
}

.brand-info h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

/* Status Badge in Header */
.connection-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.connection-status-badge .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    animation: pulse-dot 2s infinite;
}

.connection-status-badge.connected .status-dot {
    background: #10b981;
}

.connection-status-badge.disconnected .status-dot {
    background: #f59e0b;
}

.connection-status-badge.error .status-dot {
    background: #ef4444;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Card Body */
.connection-card-body {
    padding: 1.5rem;
    min-height: 280px;
}

.connection-state {
    height: 100%;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading-animation {
    margin-bottom: 1rem;
}

.loading-animation .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* QR Section */
.qr-section {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.qr-wrapper {
    position: relative;
    flex-shrink: 0;
}

.qr-frame {
    position: relative;
    padding: 12px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.qr-code {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.qr-code img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-corners {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.qr-corners span {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid #25D366;
}

.qr-corners span:nth-child(1) {
    top: 0; left: 0;
    border-right: none; border-bottom: none;
    border-radius: 8px 0 0 0;
}

.qr-corners span:nth-child(2) {
    top: 0; right: 0;
    border-left: none; border-bottom: none;
    border-radius: 0 8px 0 0;
}

.qr-corners span:nth-child(3) {
    bottom: 0; left: 0;
    border-right: none; border-top: none;
    border-radius: 0 0 0 8px;
}

.qr-corners span:nth-child(4) {
    bottom: 0; right: 0;
    border-left: none; border-top: none;
    border-radius: 0 0 8px 0;
}

.btn-refresh {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-light);
}

.btn-refresh:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
    transform: translateX(-50%) rotate(180deg);
}

.btn-refresh.loading {
    pointer-events: none;
    animation: spin 1s linear infinite;
    transform: translateX(-50%);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* QR Instructions */
.qr-instructions {
    flex: 1;
}

.qr-instructions h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-item span:last-child {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.4;
}

.step-item strong {
    color: var(--text);
}

/* Connect Prompt (Google) */
.connect-prompt {
    text-align: center;
    padding: 1rem;
}

.prompt-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(52, 168, 83, 0.1) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
}

.connect-prompt h4 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.connect-prompt > p {
    margin: 0 0 1.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.benefits-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.benefit-item svg {
    color: #10b981;
    flex-shrink: 0;
}

/* Google Button */
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-google:hover {
    border-color: #4285F4;
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.2);
    transform: translateY(-2px);
}

/* Connected State */
.connected-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
}

.connected-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: success-pulse 2s ease-in-out infinite;
}

.connected-icon-wrapper.google {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(52, 168, 83, 0.1) 100%);
}

@keyframes success-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.connected-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.connected-icon-wrapper.google .connected-icon {
    background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
}

.connected-details h4 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.connected-number,
.connected-email {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.connected-number svg,
.connected-email svg {
    color: var(--text-light);
    opacity: 0.7;
}

/* Outline Danger Button */
.btn-outline-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid #fee2e2;
    border-radius: 10px;
    color: #ef4444;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline-danger:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Card Footer */
.connection-card-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.feature-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.feature-tag {
    padding: 4px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Help Section */
.help-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-top: 2rem;
}

.help-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.help-content {
    flex: 1;
}

.help-content h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.help-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--blue);
    border-radius: 10px;
    color: var(--blue);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-outline:hover {
    background: var(--blue);
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .connections-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .connections-grid {
        grid-template-columns: 1fr;
    }

    .qr-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .qr-instructions {
        text-align: left;
    }

    .steps-list {
        text-align: left;
    }

    .help-section {
        flex-direction: column;
        text-align: center;
    }

    .connection-card-body {
        min-height: auto;
    }

    .benefits-grid {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .connection-card-header,
    .connection-card-body {
        padding: 1rem;
    }

    .brand-icon {
        width: 48px;
        height: 48px;
    }

    .brand-info h2 {
        font-size: 1.1rem;
    }

    .qr-code {
        width: 160px;
        height: 160px;
    }

    .connected-icon-wrapper {
        width: 64px;
        height: 64px;
    }

    .connected-icon {
        width: 40px;
        height: 40px;
    }
}
