/* SheetSync — Frontend Styles */

/* ── Live refresh states ── */
.sheetsync-refreshing { position: relative; }

@keyframes ssFlash { 0%{opacity:1} 40%{opacity:.35} 100%{opacity:1} }

/* Live badge */
.sheetsync-live-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 2px 8px;
    letter-spacing: .3px;
    transition: opacity .3s;
    z-index: 10;
    pointer-events: none;
}
.sheetsync-live-badge.pulse {
    animation: ssBadgePulse .6s ease;
}
@keyframes ssBadgePulse {
    0%   { background:#bbf7d0; color:#14532d; }
    50%  { background:#4ade80; color:#fff; }
    100% { background:#dcfce7; color:#16a34a; }
}

/* ── Shared layout ── */
.sheetsync-wrap { font-family: inherit; }

/* ── Table ── */
.sheetsync-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sheetsync-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.sheetsync-table thead th {
    background: #2563eb;
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.sheetsync-table tbody tr { transition: background 0.15s; }
.sheetsync-table tbody tr:nth-child(even) { background: #f8fafc; }
.sheetsync-table tbody tr:hover { background: #eff6ff; }

.sheetsync-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    word-break: break-word;
}

.sheetsync-no-data {
    text-align: center;
    color: #94a3b8;
    padding: 24px !important;
}

/* ── Responsive table (stack on mobile) ── */
@media (max-width: 600px) {
    .sheetsync-table thead { display: none; }
    .sheetsync-table tr     { display: block; border: 1px solid #e2e8f0; margin-bottom: 12px; border-radius: 8px; overflow: hidden; }
    .sheetsync-table td     { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .sheetsync-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        min-width: 120px;
        flex-shrink: 0;
    }
}

/* ── Card grid ── */
.sheetsync-card-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
}

.sheetsync-cols-1 .sheetsync-card-grid { grid-template-columns: 1fr; }
.sheetsync-cols-2 .sheetsync-card-grid { grid-template-columns: repeat(2, 1fr); }
.sheetsync-cols-3 .sheetsync-card-grid { grid-template-columns: repeat(3, 1fr); }
.sheetsync-cols-4 .sheetsync-card-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .sheetsync-cols-3 .sheetsync-card-grid,
    .sheetsync-cols-4 .sheetsync-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
    .sheetsync-card-grid { grid-template-columns: 1fr !important; }
}

.sheetsync-card-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sheetsync-card-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

.sheetsync-card-img-wrap { aspect-ratio: 16/9; overflow: hidden; }
.sheetsync-card-img      { width: 100%; height: 100%; object-fit: cover; display: block; }

.sheetsync-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.sheetsync-badge-tag {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    align-self: flex-start;
}

.sheetsync-card-title { margin: 0; font-size: 1rem; font-weight: 700; color: #1e293b; }
.sheetsync-card-desc  { margin: 0; font-size: 0.875rem; color: #64748b; flex: 1; }

.sheetsync-card-btn {
    display: inline-block;
    margin-top: auto;
    background: #2563eb;
    color: #fff !important;
    padding: 8px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    transition: background 0.15s;
}
.sheetsync-card-btn:hover { background: #1d4ed8; }

/* ── List ── */
.sheetsync-list { padding-left: 1.5em; line-height: 2; }
.sheetsync-list a { color: #2563eb; text-decoration: none; }
.sheetsync-list a:hover { text-decoration: underline; }

/* ── Pagination ── */
.sheetsync-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    justify-content: center;
}

.sheetsync-page-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.15s;
}
.sheetsync-page-btn:hover,
.sheetsync-page-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── Search bar ── */
.sheetsync-search-bar { margin-bottom: 12px; }
.sheetsync-search-input {
    width: 100%;
    max-width: 360px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}
.sheetsync-search-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* ── Dynamic image / button ── */
.sheetsync-dynamic-img { max-width: 100%; height: auto; display: block; }
.sheetsync-img          { max-width: 80px; border-radius: 4px; vertical-align: middle; }

.sheetsync-btn {
    display: inline-block;
    background: #2563eb;
    color: #fff !important;
    padding: 10px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s;
}
.sheetsync-btn:hover { background: #1d4ed8; }
