/**
 * Integrations Modal - Styling
 *
 * Styles for the integrations modal grid view and related components.
 * Simple light theme grid layout with category filter pills.
 *
 * @since 1.0.0
 */

/* ========== Message Container ========== */

.griffinforms-integrations-message-container:empty {
    margin-bottom: 0 !important;
}

/* ========== Category Filter Pills ========== */

.gf-integrations-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.gf-integrations-filter-pill {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background-color: transparent;
    border: none;
    border-radius: 100px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: var(--gf-color-text);
    font-weight: 500;
}

.gf-integrations-filter-pill:hover {
    background-color: color-mix(in srgb, var(--gf-color-primary) 10%, transparent);
}

.gf-integrations-filter-pill.active {
    background-color: color-mix(in srgb, var(--gf-color-primary) 15%, transparent);
    color: var(--gf-color-primary);
}

/* ========== Integration Grid ========== */

.gf-integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

/* ========== Integration Card ========== */

.gf-integration-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gf-color-surface);
    border: 1px solid var(--gf-color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    min-height: 120px;
    position: relative;
}

.gf-integration-card:hover {
    border-color: var(--gf-color-primary);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--gf-color-primary) 30%, transparent);
    transform: translateY(-1px);
}

.gf-integration-card:hover .gf-integration-card-icon {
    animation: gf-icon-pop 0.4s ease forwards;
}

.gf-integration-card:focus-visible {
    outline: 2px solid var(--gf-color-primary);
    outline-offset: 2px;
}

/* ========== Card Icon ========== */

.gf-integration-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.gf-integration-card-icon img,
.gf-integration-card-icon svg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@keyframes gf-icon-pop {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* ========== Card Name ========== */

.gf-integration-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    color: var(--gf-color-text);
    word-break: normal;
    white-space: normal;
    line-height: 1.2;
}

.gf-integration-card-name-single {
    white-space: nowrap;
}

.gf-integration-card-coming-soon {
    border-style: dashed;
    border-color: var(--gf-color-border);
    background: transparent;
}

.gf-integration-card-coming-soon:hover {
    border-color: var(--gf-color-text-light);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--gf-color-text-light) 30%, transparent);
}

.gf-integration-card-pill {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gf-color-bg);
    color: var(--gf-color-text);
    border-radius: 999px;
    padding: 0.15rem 0.4rem;
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.gf-integration-card-pill-pro {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    color: #fff;
    border: 0;
}

.gf-integration-card-pro-locked {
    border-style: dashed;
    border-color: var(--gf-color-border);
    background: transparent;
}

.gf-integration-card-pro-locked:hover {
    border-color: color-mix(in srgb, var(--gf-color-primary) 50%, var(--gf-color-border));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--gf-color-primary) 15%, transparent);
}

/* ========== Empty State ========== */

.gf-integrations-empty {
    grid-column: 1 / -1;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--gf-color-text-light);
    font-size: 1rem;
}

/* ========== Loading Skeleton ========== */

.gf-integrations-grid.loading {
    opacity: 0.6;
}

.gf-integration-card.skeleton {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--gf-color-bg) 85%, #fff) 25%,
        color-mix(in srgb, var(--gf-color-border) 85%, #fff) 50%,
        color-mix(in srgb, var(--gf-color-bg) 85%, #fff) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    cursor: auto;
    border-color: var(--gf-color-border);
}

.gf-integration-card.skeleton:hover {
    border-color: var(--gf-color-border);
    box-shadow: none;
    transform: none;
}

.gf-integration-card.skeleton .gf-integration-card-icon,
.gf-integration-card.skeleton .gf-integration-card-name {
    background: transparent;
    display: none;
}

.gf-integration-comingsoon-badge {
    background: transparent !important;
    border: 1px solid var(--gf-color-border) !important;
    color: #c98216 !important;
}

.gf-integration-comingsoon-alert {
    width: 100%;
    margin-bottom: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========== Info View Container ========== */

.gf-integration-info-view {
    padding: 1.5rem;
}

.gf-integration-info-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* ========== Info View Header ========== */

.gf-integration-info-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.gf-integration-info-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--gf-color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--gf-color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gf-integration-info-back:hover {
    background-color: color-mix(in srgb, var(--gf-color-primary) 10%, transparent);
    border-color: var(--gf-color-primary);
    color: var(--gf-color-primary);
}

.gf-integration-info-back-icon {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
}

.gf-integration-info-back-text {
    font-weight: 500;
}

/* ========== Integration Sections ========== */

.gf-integration-section {
    margin-bottom: 2rem;
}

.gf-integration-section:last-child {
    margin-bottom: 0;
}

.gf-integration-section-notes {
    margin-bottom: 1.75rem;
}

.gf-integration-info-note + .gf-integration-info-note {
    margin-top: 0.5rem;
}

.gf-integration-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gf-color-text);
    margin-bottom: 1rem;
    margin-top: 0;
}

/* ========== Header Section (Icon + Name/Description) ========== */

.gf-integration-section-header {
    display: flex;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
}

.gf-integration-info-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
}

.gf-integration-info-icon img,
.gf-integration-info-icon svg {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gf-integration-info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.gf-integration-info-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gf-color-text);
    margin: 0;
}

.gf-integration-info-description {
    font-size: 0.95rem;
    color: var(--gf-color-text);
    margin: 0;
    line-height: 1.5;
}

.gf-integration-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.gf-integration-header-badges .badge {
    font-size: 0.7rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--gf-color-border);
    background-color: #ffffff;
    color: var(--gf-color-text);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.gf-integration-category-badge,
.gf-integration-scope-badge {
    font-size: 0.7rem;
}

.gf-integration-sidebar-badge {
    display: inline-block;
    margin: 0 0 0.5rem;
}

/* ========== Status Section ========== */

.gf-integration-section-status {
}

.gf-integration-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gf-integration-badges .badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

.gf-integration-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    margin-right: 0.4rem;
    font-size: 1.2em;
    vertical-align: -0.125em;
}

/* ========== Requirements Section ========== */

.gf-integration-section-requirements {
}

.gf-integration-requirements-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gf-integration-requirements-list li {
    padding: 0.75rem 0;
    font-size: 0.95rem;
    color: var(--gf-color-text);
    border-bottom: 1px solid var(--gf-color-border);
}

.gf-integration-requirements-list li:last-child {
    border-bottom: none;
}

.gf-integration-requirements-list strong {
    font-weight: 600;
    color: var(--gf-color-text);
    min-width: 80px;
    display: inline-block;
}

/* ========== Sidebar ========== */

.gf-integration-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ========== Accordion Styling ========== */

.gf-integration-accordion {
    border: 1px solid var(--gf-color-border);
    border-radius: 6px;
    overflow: hidden;
}

.gf-integration-accordion .accordion-item {
    border: none;
}

.gf-integration-accordion .accordion-item + .accordion-item {
    border-top: 1px solid var(--gf-color-border);
}

.gf-integration-accordion .accordion-button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gf-color-text);
    background-color: var(--gf-color-bg);
    border: none;
}

.gf-integration-accordion .accordion-button {
    background-color: transparent;
    color: var(--gf-color-text);
    box-shadow: none;
}

.gf-integration-accordion .accordion-button:not(.collapsed) {
    background-color: transparent;
    color: var(--gf-color-primary);
    box-shadow: none;
}

.gf-integration-accordion .accordion-button:hover {
    background-color: transparent;
}

.gf-integration-accordion .accordion-button:focus {
    border-color: var(--gf-color-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--gf-color-primary) 20%, transparent);
}

.gf-integration-accordion .accordion-body {
    padding: 1rem;
    background-color: var(--gf-color-surface);
}

/* ========== Logs Section Styling ========== */

.gf-integration-logs-container {
    max-height: 320px;
    overflow-y: auto;
}

.gf-integration-log-timeline {
    position: relative;
    padding-left: 1.5rem;
    font-size: 0.78rem;
}

.gf-integration-log-timeline::before {
    content: '';
    position: absolute;
    left: 0.35rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background-color: #eceef3;
}

.gf-integration-log-entry {
    position: relative;
    padding-bottom: 1rem;
}

.gf-integration-log-entry:last-child {
    padding-bottom: 0;
}

.gf-integration-log-node {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    border: 2px solid #fff;
}

.gf-log-node-error {
    background-color: #d6453c;
}

.gf-log-node-success {
    background-color: #1c8f4c;
}

.gf-log-node-warning {
    background-color: #c98216;
}

.gf-log-node-info {
    background-color: #1a56db;
}

.gf-integration-log-content {
    padding-bottom: 0.2rem;
}

.gf-integration-log-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.gf-integration-log-type {
    text-transform: uppercase;
}

.gf-integration-log-type.gf-text-error {
    color: #d6453c;
}

.gf-integration-log-type.gf-text-success {
    color: #1c8f4c !important;
}

.gf-integration-log-type.gf-text-warning {
    color: #c98216;
}

.gf-integration-log-type.gf-text-info {
    color: #1a56db;
}

.gf-integration-log-time {
    color: var(--gf-color-text-light);
    font-weight: 500;
}

.gf-integration-log-message {
    color: var(--gf-color-text);
    word-break: break-word;
    font-size: 0.75rem;
    font-family: var(--gf-font-base, "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    line-height: 1.25;
}

.gf-integration-section-requirements-sidebar {
    background: var(--gf-color-bg);
    padding: 1.25rem;
    border-radius: 6px;
    border: 1px solid var(--gf-color-border);
}

.gf-integration-requirements-list-sidebar {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gf-integration-requirements-list-sidebar li {
    padding: 0.6rem 0;
    font-size: 0.85rem;
    color: var(--gf-color-text);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gf-integration-requirements-list-sidebar strong {
    font-weight: 600;
    color: var(--gf-color-text);
    font-size: 0.8rem;
}

.gf-integration-requirements-list-sidebar span {
    color: var(--gf-color-text-light);
    font-size: 0.8rem;
    word-break: break-word;
}

/* ========== Links Section ========== */

.gf-integration-section-links {
}

.gf-integration-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.gf-integration-link {
    display: inline;
    color: var(--gf-color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
    cursor: pointer;
}

.gf-integration-link:hover {
    color: var(--gf-color-primary-dark);
    text-decoration: underline;
}

/* ========== Actions Section ========== */

.gf-integration-section-actions {
    margin-top: 1rem;
}

.gf-integration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ========== GriffinForms Button Styling ========== */

/* Danger button (Disable) */
.gf-btn.gf-btn-danger.gf-integration-btn-disable {
    box-shadow: 0 2px 4px color-mix(in srgb, var(--gf-color-danger) 35%, transparent);
}

.gf-btn.gf-btn-danger.gf-integration-btn-disable:hover {
    box-shadow: 0 2px 8px color-mix(in srgb, var(--gf-color-danger) 45%, transparent);
}

/* ========== Responsive Design ========== */

@media (max-width: 768px) {
    .gf-integrations-grid {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
        gap: 0.6rem;
    }

    .gf-integration-card {
        padding: 0.6rem;
        gap: 0.4rem;
        min-height: 110px;
    }

    .gf-integration-card-icon {
        width: 32px;
        height: 32px;
    }

    .gf-integration-card-name {
        font-size: 0.75rem;
    }

    .gf-integrations-filters {
        gap: 0.4rem;
    }

    .gf-integrations-filter-pill {
        padding: 0.3rem 0.7rem;
        font-size: 0.8rem;
    }

    .gf-integration-info-view {
        padding: 1rem;
    }

    .gf-integration-info-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gf-integration-section-header {
        flex-direction: column;
        gap: 1rem;
    }

    .gf-integration-info-icon {
        width: 60px;
        height: 60px;
    }

    .gf-integration-info-name {
        font-size: 1.25rem;
    }

    .gf-integration-info-sidebar {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .gf-integrations-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 0.5rem;
    }

    .gf-integration-card {
        padding: 0.5rem;
        gap: 0.35rem;
        min-height: 100px;
    }

    .gf-integration-card-icon {
        width: 28px;
        height: 28px;
    }

    .gf-integration-card-name {
        font-size: 0.7rem;
    }

    .gf-integrations-filters {
        gap: 0.3rem;
    }

    .gf-integrations-filter-pill {
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
    }

    .gf-integration-info-view {
        padding: 0.75rem;
    }

    .gf-integration-info-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gf-integration-info-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .gf-integration-info-back {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .gf-integration-section-header {
        gap: 0.75rem;
        padding-bottom: 1rem;
    }

    .gf-integration-info-icon {
        width: 50px;
        height: 50px;
    }

    .gf-integration-info-name {
        font-size: 1.1rem;
    }

    .gf-integration-info-description {
        font-size: 0.85rem;
    }

    .gf-integration-section-status {
        padding: 1rem;
    }

    .gf-integration-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .gf-integration-btn {
        width: 100%;
    }

    .gf-integration-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    .gf-integration-info-sidebar {
        gap: 0.75rem;
    }

    .gf-integration-section-requirements-sidebar {
        padding: 1rem;
    }
}

/* ========== Mapping Rows (shared) ========== */
.gf-mapping-row {
    background: transparent;
    border: none;
    border-radius: 0;
}

.gf-mapping-flex {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.gf-mapping-col {
    flex: 1 1 50%;
    min-width: 260px;
    max-width: 49%;
}

.gf-mapping-col-label .small {
    line-height: 1.4;
}

.gf-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.gf-link:hover,
.gf-link:focus {
    color: var(--gf-color-primary) !important;
    text-decoration: none;
}
