/* Integrations Tab Specific Styling for AMD Construction Pro */

/* --- Main Integrations Layout --- */
#integrations-tab {
    height: 100dvh;
    width: 100vw;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f4f6fa;
}

.integrations-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f4f6fa;
}

/* Section Headers - Match Company tab styling */
.section-header {
    color: #fff !important;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    padding: 16px 24px !important;
    margin: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    letter-spacing: 0.5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: none !important;
    border: none !important;
    text-shadow: none !important;
    min-height: auto !important;
    height: auto !important;
}

.section-header h3 {
    margin: 0 !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Main Content Area --- */
.integrations-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: #f4f6fa;
}

/* --- Integration Stats --- */
.integration-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
}

/* --- Integration Categories --- */
.integration-category {
    margin-bottom: 40px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e1e5e9;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-title i {
    font-size: 20px;
    color: #1e40af;
}

.category-title h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.category-count {
    font-size: 14px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* --- Integration Grid --- */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* --- Integration Cards --- */
.integration-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.integration-card.connected {
    border-color: #10b981;
    background: linear-gradient(to bottom, #ecfdf5 0%, #fff 100%);
}

.integration-card.warning {
    border-color: #f59e0b;
    background: linear-gradient(to bottom, #fffbeb 0%, #fff 100%);
}

.integration-card.error {
    border-color: #ef4444;
    background: linear-gradient(to bottom, #fef2f2 0%, #fff 100%);
}

/* --- Card Header --- */
.integration-header {
    padding: 20px 20px 0 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.integration-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

/* Logo Colors */
.integration-logo.quickbooks { background: linear-gradient(135deg, #0077c5 0%, #004a7c 100%); }
.integration-logo.xero { background: linear-gradient(135deg, #13b5ea 0%, #0e8fb8 100%); }
.integration-logo.stripe { background: linear-gradient(135deg, #635bff 0%, #4f46e5 100%); }
.integration-logo.paypal { background: linear-gradient(135deg, #0070ba 0%, #005694 100%); }
.integration-logo.square { background: linear-gradient(135deg, #000 0%, #333 100%); }
.integration-logo.plaid { background: linear-gradient(135deg, #00d2ff 0%, #0087cc 100%); }
.integration-logo.chase { background: linear-gradient(135deg, #117aca 0%, #0e629a 100%); }
.integration-logo.bofa { background: linear-gradient(135deg, #e31837 0%, #b71c1c 100%); }
.integration-logo.wells-fargo { background: linear-gradient(135deg, #d71e2b 0%, #a8161f 100%); }
.integration-logo.facebook { background: linear-gradient(135deg, #1877f2 0%, #1356c4 100%); }
.integration-logo.google { background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%); }
.integration-logo.homeadvisor { background: linear-gradient(135deg, #ff6600 0%, #cc5200 100%); }
.integration-logo.thumbtack { background: linear-gradient(135deg, #009fd9 0%, #0087b5 100%); }
.integration-logo.angi { background: linear-gradient(135deg, #ff6a00 0%, #e55a00 100%); }
.integration-logo.mailchimp { background: linear-gradient(135deg, #ffe01b 0%, #ffca28 100%); color: #333; }
.integration-logo.homedepot { background: linear-gradient(135deg, #f96302 0%, #d4530a 100%); }
.integration-logo.lowes { background: linear-gradient(135deg, #004990 0%, #003366 100%); }
.integration-logo.ferguson { background: linear-gradient(135deg, #0066cc 0%, #004d99 100%); }
.integration-logo.menards { background: linear-gradient(135deg, #ffd700 0%, #e6c200 100%); color: #333; }
.integration-logo.lumber84 { background: linear-gradient(135deg, #8b4513 0%, #654321 100%); }
.integration-logo.sherwin { background: linear-gradient(135deg, #0065bd 0%, #004d8f 100%); }
.integration-logo.salesforce { background: linear-gradient(135deg, #00a1e0 0%, #0073a8 100%); }
.integration-logo.hubspot { background: linear-gradient(135deg, #ff7a59 0%, #ff5722 100%); }
.integration-logo.twilio { background: linear-gradient(135deg, #f22f46 0%, #d1233a 100%); }
.integration-logo.zapier { background: linear-gradient(135deg, #ff4a00 0%, #cc3700 100%); }
.integration-logo.slack { background: linear-gradient(135deg, #4a154b 0%, #36103a 100%); }
.integration-logo.google-workspace { background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%); }
.integration-logo.microsoft { background: linear-gradient(135deg, #00bcf2 0%, #0078d4 100%); }
.integration-logo.procore { background: linear-gradient(135deg, #ffa500 0%, #e69500 100%); }
.integration-logo.buildertrend { background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%); }
.integration-logo.monday { background: linear-gradient(135deg, #ff3d71 0%, #ff1744 100%); }
.integration-logo.dropbox { background: linear-gradient(135deg, #0061ff 0%, #004ed9 100%); }
.integration-logo.box { background: linear-gradient(135deg, #0061d5 0%, #004ba8 100%); }
.integration-logo.aws { background: linear-gradient(135deg, #ff9900 0%, #e68a00 100%); }
.integration-logo.docusign { background: linear-gradient(135deg, #ffcc00 0%, #e6b800 100%); color: #333; }

.integration-status {
    flex-shrink: 0;
}

/* --- Status Indicators --- */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-indicator.online {
    background: #dcfce7;
    color: #166534;
}

.status-indicator.offline {
    background: #f3f4f6;
    color: #6b7280;
}

.status-indicator.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-indicator.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

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

/* --- Card Info --- */
.integration-info {
    padding: 16px 20px;
    flex: 1;
}

.integration-info h5 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.integration-info p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* --- Feature Tags --- */
.integration-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.feature-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.integration-card.connected .feature-tag {
    background: #d1fae5;
    color: #065f46;
}

.integration-card.warning .feature-tag {
    background: #fef3c7;
    color: #92400e;
}

/* --- Card Actions --- */
.integration-actions {
    padding: 16px 20px 20px 20px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
}

/* --- Buttons --- */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn.primary {
    background: #1e40af;
    color: white;
}

.btn.primary:hover {
    background: #1d4ed8;
}

.btn.secondary {
    background: #6b7280;
    color: white;
}

.btn.secondary:hover {
    background: #4b5563;
}

.btn.success {
    background: #059669;
    color: white;
}

.btn.success:hover {
    background: #047857;
}

.btn.warning {
    background: #d97706;
    color: white;
}

.btn.warning:hover {
    background: #b45309;
}

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

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

.btn.outline {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}

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

/* --- Responsive Design --- */
@media (max-width: 1200px) {
    .integrations-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 900px) {
    .integrations-content {
        padding: 16px;
    }
    
    .integration-stats {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .integrations-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .section-header {
        padding: 12px 16px !important;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .integration-header {
        padding: 16px 16px 0 16px;
    }
    
    .integration-info {
        padding: 12px 16px;
    }
    
    .integration-actions {
        padding: 12px 16px 16px 16px;
        flex-direction: column;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* --- Loading and Animation States --- */
.integration-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.integration-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #1e40af;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Accessibility --- */
.integration-card:focus-within {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

/* --- Dark Mode Support (Future) --- */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
}

@media (max-width: 1200px) {
    #integrations-tab .integrations-layout {
        flex-direction: column;
    }
}
