/**
 * WooCommerce Tool Access - Tool Links Styles
 * Light Theme - High Specificity Override
 *
 * @package WooCommerce_Tool_Access
 */

/* =====================================================
   Tool Access Section (Order Detail Page)
   ===================================================== */

.woocommerce-order-details .wc-tool-access-links,
.woocommerce-account .wc-tool-access-links,
section.wc-tool-access-links {
    margin: 2rem 0 !important;
    padding: 1.5rem !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.wc-tool-access-links h2,
section.wc-tool-access-links h2 {
    margin: 0 0 0.5rem !important;
    padding: 0 !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    background: transparent !important;
    border: none !important;
}

.wc-tool-access-links .wc-tool-access-description,
p.wc-tool-access-description {
    margin: 0 0 1.25rem !important;
    padding: 0 !important;
    color: #6b7280 !important;
    font-size: 0.9rem !important;
    background: transparent !important;
}

/* Cards Container */
.wc-tool-access-links .wc-tool-access-cards,
div.wc-tool-access-cards {
    display: grid !important;
    gap: 1rem !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    background: transparent !important;
}

/* Card */
.wc-tool-access-cards .wc-tool-access-card,
div.wc-tool-access-card {
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden !important;
    transition: box-shadow 0.2s ease !important;
    border: 1px solid #e5e7eb !important;
}

.wc-tool-access-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.wc-tool-access-card.is-expired {
    opacity: 0.6 !important;
    background: #f9fafb !important;
}

.wc-tool-access-card.is-completed {
    border-color: #10b981 !important;
    border-left-width: 3px !important;
}

.wc-tool-access-card.is-ready-for-print {
    border-color: #8b5cf6 !important;
    border-left-width: 3px !important;
    background: #faf5ff !important;
}

/* Card Header */
.wc-tool-access-card .wc-tool-access-card-header,
div.wc-tool-access-card-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.875rem 1rem !important;
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.wc-tool-access-card-header h3,
.wc-tool-access-card-header .wc-tool-access-card-title,
h3.wc-tool-access-card-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    background: transparent !important;
    border: none !important;
}

/* Status Badge */
.wc-tool-access-card-header .wc-tool-access-status,
span.wc-tool-access-status {
    display: inline-flex !important;
    align-items: center !important;
    padding: 0.2rem 0.6rem !important;
    border-radius: 4px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    border: none !important;
}

.wc-tool-access-status.status-active,
span.wc-tool-access-status.status-active {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.wc-tool-access-status.status-completed,
span.wc-tool-access-status.status-completed {
    background: #dbeafe !important;
    color: #1e40af !important;
}

/* In Progress status badge */
.wc-tool-access-status.status-in-progress,
span.wc-tool-access-status.status-in-progress {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* Ready for Print status badge */
.wc-tool-access-status.status-ready-for-print,
span.wc-tool-access-status.status-ready-for-print {
    background: #ede9fe !important;
    color: #5b21b6 !important;
}

.wc-tool-access-status.status-expired,
span.wc-tool-access-status.status-expired {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

/* Card Body */
.wc-tool-access-card .wc-tool-access-card-body,
div.wc-tool-access-card-body {
    padding: 1rem !important;
    background: #ffffff !important;
    border: none !important;
}

/* Progress Bar */
.wc-tool-access-card-body .wc-tool-access-progress,
div.wc-tool-access-progress {
    margin-bottom: 0.75rem !important;
    background: transparent !important;
}

.wc-tool-access-progress .wc-tool-access-progress-text,
div.wc-tool-access-progress-text {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 0.4rem !important;
    font-size: 0.8rem !important;
    color: #4b5563 !important;
    background: transparent !important;
}

.wc-tool-access-progress .wc-tool-access-progress-bar,
div.wc-tool-access-progress-bar {
    height: 6px !important;
    background: #e5e7eb !important;
    border-radius: 3px !important;
    overflow: hidden !important;
}

.wc-tool-access-progress-bar .wc-tool-access-progress-fill,
div.wc-tool-access-progress-fill {
    height: 100% !important;
    background: #6366f1 !important;
    border-radius: 3px !important;
    transition: width 0.3s ease !important;
}

.is-completed .wc-tool-access-progress-fill {
    background: #10b981 !important;
}

/* Expiry Info */
.wc-tool-access-card-body .wc-tool-access-expiry,
div.wc-tool-access-expiry {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    font-size: 0.8rem !important;
    color: #6b7280 !important;
    background: transparent !important;
}

/* Ready for Print Info */
.wc-tool-access-card-body .wc-tool-access-ready-info,
div.wc-tool-access-ready-info {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    font-size: 0.8rem !important;
    color: #5b21b6 !important;
    background: transparent !important;
    margin-bottom: 0.5rem !important;
}

.wc-tool-access-expiry .wc-tool-access-icon,
svg.wc-tool-access-icon {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
    opacity: 0.7 !important;
}

/* Card Footer */
.wc-tool-access-card .wc-tool-access-card-footer,
div.wc-tool-access-card-footer {
    padding: 0.875rem 1rem !important;
    border-top: 1px solid #e5e7eb !important;
    background: #fafafa !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}

/* Button */
.wc-tool-access-card-footer .wc-tool-access-button,
.wc-tool-access-button,
a.wc-tool-access-button,
span.wc-tool-access-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 0.625rem 1rem !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    text-align: center !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
    border: none !important;
    box-shadow: none !important;
}

.wc-tool-access-button.button.alt,
a.wc-tool-access-button.button.alt {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

.wc-tool-access-button.button.alt:hover,
a.wc-tool-access-button.button.alt:hover {
    background: #4338ca !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.is-completed .wc-tool-access-button.button.alt,
.is-completed a.wc-tool-access-button.button.alt {
    background: #059669 !important;
}

.is-completed .wc-tool-access-button.button.alt:hover,
.is-completed a.wc-tool-access-button.button.alt:hover {
    background: #047857 !important;
}

.wc-tool-access-button.disabled,
span.wc-tool-access-button.disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .wc-tool-access-links,
    section.wc-tool-access-links {
        padding: 1rem !important;
        margin: 1rem 0 !important;
    }

    .wc-tool-access-links h2 {
        font-size: 1.1rem !important;
    }

    .wc-tool-access-cards,
    div.wc-tool-access-cards {
        grid-template-columns: 1fr !important;
    }

    .wc-tool-access-card-header,
    div.wc-tool-access-card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.4rem !important;
    }
}

/* =====================================================
   Pending Message (Thank You Page)
   ===================================================== */

.wc-tool-access-links.wc-tool-access-pending {
    background: #fffbeb !important;
    border-color: #fcd34d !important;
}

.wc-tool-access-pending .wc-tool-access-pending-message {
    display: flex !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 1rem !important;
    background: #fef3c7 !important;
    border-radius: 6px !important;
    border: 1px solid #fcd34d !important;
}

.wc-tool-access-pending-icon {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    color: #d97706 !important;
    margin-top: 2px !important;
}

.wc-tool-access-pending-text {
    flex: 1 !important;
}

.wc-tool-access-pending-text strong {
    display: block !important;
    color: #92400e !important;
    font-size: 0.95rem !important;
    margin-bottom: 0.25rem !important;
}

.wc-tool-access-pending-text p {
    margin: 0 !important;
    color: #a16207 !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
}

/* Spinner Animation */
.wc-tool-access-spinner {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    border: 3px solid #fcd34d !important;
    border-top-color: #d97706 !important;
    border-radius: 50% !important;
    animation: wc-tool-access-spin 1s linear infinite !important;
    margin-top: 2px !important;
}

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

/* Countdown text */
.wc-tool-access-countdown {
    color: #b45309 !important;
    font-weight: 600 !important;
    margin-left: 4px !important;
}

/* Polling state - pulse animation on container */
.wc-tool-access-polling {
    animation: wc-tool-access-pulse 2s ease-in-out infinite !important;
}

@keyframes wc-tool-access-pulse {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    50% {
        box-shadow: 0 4px 12px rgba(252, 211, 77, 0.4) !important;
    }
}

/* =====================================================
   Orders List - Tools Column Styles
   ===================================================== */

.woocommerce-orders-table .wc-tool-access-column-links,
div.wc-tool-access-column-links {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    background: transparent !important;
}

.wc-tool-access-column-links .wc-tool-access-link,
a.wc-tool-access-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
    line-height: 1.3 !important;
}

.wc-tool-access-link.active,
a.wc-tool-access-link.active {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
}

.wc-tool-access-link.active:hover,
a.wc-tool-access-link.active:hover {
    background: #bbf7d0 !important;
    color: #166534 !important;
    text-decoration: none !important;
}

/* In Progress - amber/yellow */
.wc-tool-access-link.in_progress,
a.wc-tool-access-link.in_progress {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

.wc-tool-access-link.in_progress:hover,
a.wc-tool-access-link.in_progress:hover {
    background: #fde68a !important;
    color: #92400e !important;
    text-decoration: none !important;
}

.wc-tool-access-link.completed,
a.wc-tool-access-link.completed {
    background: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}

.wc-tool-access-link.completed:hover,
a.wc-tool-access-link.completed:hover {
    background: #bfdbfe !important;
    color: #1e40af !important;
    text-decoration: none !important;
}

/* Ready for Print - purple/violet */
.wc-tool-access-link.ready_for_print,
a.wc-tool-access-link.ready_for_print {
    background: #ede9fe !important;
    color: #5b21b6 !important;
    border: 1px solid #c4b5fd !important;
}

.wc-tool-access-link.ready_for_print:hover,
a.wc-tool-access-link.ready_for_print:hover {
    background: #ddd6fe !important;
    color: #5b21b6 !important;
    text-decoration: none !important;
}

.wc-tool-access-link.expired,
a.wc-tool-access-link.expired {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
}

.wc-tool-access-link .status,
.wc-tool-access-link span.status {
    display: inline-block !important;
    padding: 1px 5px !important;
    background: rgba(0, 0, 0, 0.08) !important;
    border-radius: 3px !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
}

.wc-tool-access-na,
span.wc-tool-access-na {
    color: #d1d5db !important;
    font-size: 1rem !important;
}

/* Orders table column width */
.woocommerce-orders-table th.woocommerce-orders-table__header-tools,
.woocommerce-orders-table td.woocommerce-orders-table__cell-tools {
    min-width: 150px !important;
    vertical-align: middle !important;
}

/* Responsive for orders list */
@media (max-width: 768px) {
    .wc-tool-access-column-links {
        gap: 4px !important;
    }

    .wc-tool-access-link,
    a.wc-tool-access-link {
        padding: 4px 6px !important;
        font-size: 0.7rem !important;
    }

    .wc-tool-access-link .status {
        font-size: 0.6rem !important;
        padding: 1px 3px !important;
    }

    .woocommerce-orders-table th.woocommerce-orders-table__header-tools,
    .woocommerce-orders-table td.woocommerce-orders-table__cell-tools {
        min-width: 120px !important;
    }
}
