/**
 * File: src/assets/css/clisyc-appointments-cards.css
 * Styles for the new [clisyc_appointments_cards] shortcode.
 *
 * @package    ClientSync
 * @subpackage ClientSync/Assets/CSS
 */

/* --- 1. Main Container & Layout --- */
#clisyc-appointments-cards-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #374151;
    max-width: 1200px;
    margin: 2em auto;
}

#clisyc-appointments-cards-dashboard h2 {
    font-size: 1.8em;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.8em;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5em;
}

/* --- 2. Filter Controls --- */
.clisyc-cards-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 2em;
    align-items: flex-end;
}

.clisyc-cards-filter-controls .clisyc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clisyc-cards-filter-controls label {
    font-weight: 600;
    font-size: 0.9em;
    color: #4b5563;
}

.clisyc-cards-filter-controls input[type="text"],
.clisyc-cards-filter-controls select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-width: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.clisyc-cards-filter-controls input[type="text"]:focus,
.clisyc-cards-filter-controls select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* --- 3. Card Grid --- */
.clisyc-appointments-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* --- 4. Individual Cards --- */
.clisyc-appointment-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.clisyc-appointment-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--clisyc-accent-hover-bg, linear-gradient(135deg, #3b82f6 0%, #2563eb 100%));
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.2s ease-in-out;
}

.clisyc-appointment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.clisyc-appointment-card:hover::before {
    transform: scaleY(1);
}

.clisyc-card-header h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0 0 16px;
    padding-right: 100px; /* Space for the badge */
    line-height: 1.3;
}

/* --- 5. Status Badges --- */
.clisyc-card-status-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clisyc-status-confirmed {
    background-color: #d1fae5;
    color: #065f46;
}
.clisyc-status-pending {
    background-color: #fef3c7;
    color: #92400e;
}
.clisyc-status-cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}
.clisyc-status-completed {
    background-color: #e0e7ff;
    color: #3730a3;
}
.clisyc-status-waitlisted {
    background-color: #dbeafe;
    color: #1e40af;
}

/* --- 6. Date/Time Section --- */
.clisyc-card-datetime {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-top: 1px solid #f3f4f6;
    padding-top: 16px;
}

.clisyc-card-datetime-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clisyc-card-datetime-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clisyc-icon-bg, #1F2938);
    color: var(--clisyc-icon-text, #ffffff);
}

.clisyc-card-datetime-icon .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.clisyc-card-datetime-text {
    font-size: 0.9em;
    line-height: 1.4;
}

.clisyc-card-datetime-text strong {
    display: block;
    font-weight: 600;
    color: #111827;
}

.clisyc-card-datetime-text span {
    color: #6b7280;
}

/* --- 6b. Dimension Details in Cards --- */
.clisyc-card-dimensions {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

.clisyc-card-dimensions li {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9em;
}

.clisyc-card-dimensions li:not(:last-child) {
    border-bottom: 1px solid #f9fafb;
}

.clisyc-card-dimensions .clisyc-dim-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--clisyc-icon-bg, #1F2938);
    color: var(--clisyc-icon-text, #ffffff);
    font-size: 12px;
    margin-right: 8px;
}

.clisyc-card-dimensions .clisyc-dim-icon .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

.clisyc-card-dim-label {
    font-weight: 500;
    color: #6b7280;
}

.clisyc-card-dim-value {
    margin-left: auto;
    font-weight: 600;
    color: #1f2937;
}

/* --- 7. Action Buttons --- */
.clisyc-card-actions {
    margin-top: auto; /* Pushes to bottom */
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clisyc-card-actions .button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 100%;
    padding: 12px;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s;
    min-height: 44px;
}

.clisyc-card-actions .button-primary {
    background: var(--clisyc-accent-normal-bg, #f3f4f6);
    border-color: var(--clisyc-accent-normal-border, #e5e7eb);
    color: var(--clisyc-accent-normal-text, #374151);
}

.clisyc-card-actions .button-primary:hover {
    background: var(--clisyc-accent-hover-bg, #e5e7eb);
    border-color: var(--clisyc-accent-hover-bg, #d1d5db);
    color: var(--clisyc-accent-hover-text, #111827);
}

.clisyc-card-actions .button-secondary {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #374151;
}
.clisyc-card-actions .button-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

.clisyc-card-actions .button.clisyc-action-cancel {
    background: transparent;
    border: none;
    color: #ef4444;
    box-shadow: none;
}

.clisyc-card-actions .button.clisyc-action-cancel:hover {
    background: #fee2e2;
    color: #991b1b;
}

/* --- 8. Loading / Empty / Error States --- */
.clisyc-cards-state-container {
    position: relative;
    min-height: 200px;
}

.clisyc-cards-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0s 0.2s;
}

.clisyc-cards-loading-overlay.is-active {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.clisyc-cards-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #d1d5db;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: clisyc-cards-spin 0.8s linear infinite;
}

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

.clisyc-cards-empty-state,
.clisyc-cards-error-message {
    display: none;
    text-align: center;
    padding: 60px 20px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
}

.clisyc-cards-error-message {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* --- 9. Pagination --- */
.clisyc-cards-pagination {
    margin-top: 2em;
    text-align: center;
}

.clisyc-cards-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    transition: all 0.2s;
}

.clisyc-cards-pagination .page-numbers:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.clisyc-cards-pagination .page-numbers.current {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    font-weight: 600;
}

/* --- 10. Responsive Queries --- */
@media (max-width: 1024px) {
    .clisyc-appointments-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }
}

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

    .clisyc-card-actions {
        flex-direction: column;
    }
    
    .clisyc-cards-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .clisyc-cards-filter-controls input[type="text"],
    .clisyc-cards-filter-controls select {
        width: 100%;
        min-width: 0;
    }
}

/* --- 11. Accessibility --- */
.clisyc-card-actions .button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .clisyc-appointment-card,
    .clisyc-appointment-card::before,
    .clisyc-card-actions .button,
    .clisyc-cards-loading-overlay,
    .clisyc-cards-pagination .page-numbers {
        transition-duration: 0.01ms !important;
    }
    .clisyc-cards-spinner {
        animation-duration: 2s !important;
    }
}

/* --- Print Styles --- */
@media print {
    .clisyc-cards-filter-controls,
    .clisyc-card-actions,
    .clisyc-cards-pagination {
        display: none !important;
    }

    #clisyc-appointments-cards-dashboard h2 {
        border: none;
    }

    .clisyc-appointments-cards-grid {
        display: block;
    }

    .clisyc-appointment-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 20px;
    }
}