/**
 * WC Custom Downloads Display - Frontend Styles
 */

/* Main wrapper */
.wccd-downloads-wrapper {
    margin: 20px 0;
}

/* Header section */
.wccd-downloads-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.wccd-downloads-header h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

/* Controls section */
.wccd-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* Search box */
.wccd-search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 300px;
}

.wccd-search-box input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wccd-search-box button {
    padding: 8px 16px !important;
    margin-bottom: 10px !important;
    background: #2271b1 !important;
    color: white !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px !important;
    transition: background 0.3s;
}

.wccd-search-box button:hover {
    background: #135e96 !important;
}

#wccd-clear-search {
    background: #dc3232 !important;
}

#wccd-clear-search:hover {
    background: #aa2222 !important;
}

/* Sort options */
.wccd-sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wccd-sort-options label {
    font-weight: 600;
    color: #666;
}

.wccd-sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* Downloads table */
.wccd-downloads-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wccd-downloads-table thead {
    background: #f7f7f7;
}

.wccd-downloads-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.wccd-downloads-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.wccd-downloads-table tbody tr {
    transition: background 0.3s;
}

.wccd-downloads-table tbody tr:hover {
    background: #f9f9f9;
}

/* Product name column */
.wccd-product-name {
    font-weight: 500;
}

.wccd-product-name a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s;
}

.wccd-product-name a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Gift badge */
.wccd-gift-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #4CAF50 !important;
    color: white;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Expiry date column */
.wccd-expiry-date {
    color: #666;
}

.wccd-expiry-date .expired {
    color: #dc3232;
    font-weight: 600;
}

/* Download link column */
.wccd-download-button {
    display: inline-block;
    padding: 8px 16px;
    background: #4CAF50 !important;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 14px;
}

.wccd-download-button:hover {
    background: #45a049 !important;
}

/* Expired items */
.wccd-download-row.expired {
    opacity: 0.6;
}

.wccd-expired-text {
    color: #999;
    font-style: italic;
}

.wccd-expired-text small {
    color: #dc3232;
    font-weight: 600;
}

/* No downloads message */
.wccd-no-downloads {
    padding: 40px;
    text-align: center;
    background: #f7f7f7;
    border-radius: 4px;
}

.wccd-no-downloads p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* No results in table */
.no-results {
    text-align: center !important;
    padding: 30px !important;
    color: #666;
    font-style: italic;
}

/* Loading indicator */
.wccd-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 40px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 15px;
}

.wccd-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: wccd-spin 1s linear infinite;
}

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

/* Error message */
.wccd-error-message {
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Responsive design */
@media (max-width: 768px) {
    .wccd-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wccd-search-box {
        min-width: 100%;
    }
    
    .wccd-sort-options {
        justify-content: space-between;
    }
    
    .wccd-downloads-table {
        font-size: 14px;
    }
    
    .wccd-downloads-table th,
    .wccd-downloads-table td {
        padding: 10px;
    }
    
    .wccd-download-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .wccd-downloads-table,
    .wccd-orders-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .wccd-gift-badge {
        display: block;
        margin-left: 0;
        margin-top: 5px;
        width: fit-content;
    }
}

/* Orders specific styles */
.wccd-orders-wrapper {
    margin: 20px 0;
}

.wccd-orders-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.wccd-orders-header h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
}

.wccd-orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wccd-orders-table thead {
    background: #f7f7f7;
}

.wccd-orders-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.wccd-orders-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

.wccd-orders-table tbody tr {
    transition: background 0.3s;
}

.wccd-orders-table tbody tr:hover {
    background: #f9f9f9;
}

.wccd-orders-table tbody tr {
    background: white;
}

/* Order number column */
.wccd-order-number {
    font-weight: 600;
    color: #2271b1;
}

.wccd-order-number .wccd-gift-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #4CAF50 !important;
    color: white;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Order date column */
.wccd-order-date {
    color: #666;
    font-size: 14px;
}

/* Order products column */
.wccd-order-products a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s;
}

.wccd-order-products a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Order status column */
.wccd-order-status {
    width: 140px;
    min-width: 140px;
    text-align: center;
}

.wccd-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wccd-status-badge.status-completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wccd-status-badge.status-processing {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.wccd-status-badge.status-on-hold {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.wccd-status-badge.status-pending {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wccd-status-badge.status-cancelled {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wccd-status-badge.status-refunded {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

.wccd-status-badge.status-failed {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Order total column */
.wccd-order-total {
    width: 120px;
    min-width: 120px;
    font-weight: 600;
    color: #333;
    text-align: right;
}

/* Order actions column */
.wccd-order-actions {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

.wccd-view-button {
    display: inline-block;
    padding: 8px 16px;
    background: #2271b1 !important;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 13px;
    white-space: nowrap;
}

.wccd-view-button:hover {
    background: #135e96 !important;
}

/* Gift order styling */
.wccd-order-row.gift-order {
    border-left: 4px solid #4CAF50 !important;
    background: white !important;
}

/* No orders message */
.wccd-no-orders {
    padding: 40px;
    text-align: center;
    background: #f7f7f7;
    border-radius: 4px;
}

.wccd-no-orders p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* View Order Page styles */
.wccd-view-order-wrapper {
    margin: 20px 0;
}

.wccd-view-order-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.wccd-view-order-header h2 {
    margin-bottom: 15px;
    font-size: 24px;
    color: #333;
}

.wccd-view-order-header h2 .wccd-gift-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #4CAF50 !important;
    color: white;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.wccd-order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.wccd-order-meta > div {
    flex: 1;
    min-width: 200px;
}

.wccd-order-actions {
    margin-top: 15px;
}

.wccd-order-details {
    display: grid;
    gap: 30px;
}

.wccd-order-items h3,
.wccd-order-downloads h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.wccd-order-items-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wccd-order-items-table th,
.wccd-order-items-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.wccd-order-items-table th {
    background: #f7f7f7;
    font-weight: 600;
    color: #333;
}

.wccd-order-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.wccd-order-addresses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    grid-column: 1 / -1;
}

.wccd-billing-address,
.wccd-shipping-address,
.wccd-payment-method,
.wccd-customer-note {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.wccd-billing-address h4,
.wccd-shipping-address h4,
.wccd-payment-method h4,
.wccd-customer-note h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.wccd-address-content {
    color: #666;
    line-height: 1.5;
}

/* Responsive design for orders */
@media (max-width: 768px) {
    .wccd-order-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .wccd-order-meta > div {
        min-width: 100%;
    }
    
    .wccd-orders-table,
    .wccd-order-items-table {
        font-size: 14px;
    }
    
    .wccd-orders-table th,
    .wccd-orders-table td,
    .wccd-order-items-table th,
    .wccd-order-items-table td {
        padding: 10px;
    }
    
    .wccd-view-button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .wccd-order-actions {
        width: 100px;
        min-width: 100px;
    }
    
    .wccd-order-status {
        width: 120px;
        min-width: 120px;
    }
    
    .wccd-order-total {
        width: 100px;
        min-width: 100px;
    }
    
    .wccd-order-info {
        grid-template-columns: 1fr;
    }
    
    .wccd-order-addresses {
        grid-template-columns: 1fr;
    }
}

/* WCFM Followings, Support Tickets & Enquiry styling to match our theme */

/* Followings, Support Tickets & Enquiry page styling */
.woocommerce-followings-table,
.woocommerce-support-tickets-table,
.woocommerce-enquiry-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.woocommerce-followings-table thead,
.woocommerce-support-tickets-table thead,
.woocommerce-enquiry-table thead {
    background: #f7f7f7;
}

.woocommerce-followings-table th,
.woocommerce-support-tickets-table th,
.woocommerce-enquiry-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.woocommerce-followings-table td,
.woocommerce-support-tickets-table td,
.woocommerce-enquiry-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    background: white;
}

.woocommerce-followings-table tbody tr,
.woocommerce-support-tickets-table tbody tr,
.woocommerce-enquiry-table tbody tr {
    transition: background 0.3s;
    background: white;
}

.woocommerce-followings-table tbody tr:hover,
.woocommerce-support-tickets-table tbody tr:hover,
.woocommerce-enquiry-table tbody tr:hover {
    background: #f9f9f9;
}

/* Followings specific styling */
.woocommerce-followings-table__cell-followings-name a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.woocommerce-followings-table__cell-followings-name a:hover {
    color: #135e96;
    text-decoration: underline;
}

.woocommerce-followings-table__cell-followings-email a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s;
}

.woocommerce-followings-table__cell-followings-email a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Support tickets specific styling */
.woocommerce-support-tickets-table__cell-support-tickets-number a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.woocommerce-support-tickets-table__cell-support-tickets-number a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Enquiry specific styling */
.woocommerce-enquiry-table__cell-enquiry-number a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.woocommerce-enquiry-table__cell-enquiry-number a:hover {
    color: #135e96;
    text-decoration: underline;
}

.woocommerce-enquiry-table__cell-enquiry-category a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s;
}

.woocommerce-enquiry-table__cell-enquiry-category a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Status indicators */
.support-status {
    font-size: 16px;
    margin-right: 5px;
}

.support-status.wcicon-status-processing {
    color: #0c5460;
}

.support-status.wcicon-status-completed {
    color: #155724;
}

/* Priority badges */
.support-priority {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.support-priority-low {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.support-priority-medium {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.support-priority-high {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.support-priority-critical {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

/* Action buttons styling */
.woocommerce-followings-table .wcfm_followings_delete,
.woocommerce-support-tickets-table .woocommerce-button.button.view,
.woocommerce-enquiry-table .woocommerce-button.button.view {
    display: inline-block;
    padding: 6px 12px;
    background: #2271b1 !important;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 13px;
    border: none;
    cursor: pointer;
}

.woocommerce-followings-table .wcfm_followings_delete:hover,
.woocommerce-support-tickets-table .woocommerce-button.button.view:hover,
.woocommerce-enquiry-table .woocommerce-button.button.view:hover {
    background: #135e96 !important;
}

/* Delete button specific styling */
.woocommerce-followings-table .wcfm_followings_delete {
    background: #dc3545 !important;
    padding: 8px;
    border-radius: 4px;
}

.woocommerce-followings-table .wcfm_followings_delete:hover {
    background: #c82333 !important;
}

.woocommerce-followings-table .wcfm_followings_delete .wcfmfa {
    color: white;
    font-size: 14px;
}

/* Actions column width */
.woocommerce-followings-table__header-followings-actions,
.woocommerce-support-tickets-table__header-support-tickets-actions,
.woocommerce-enquiry-table__header-enquiry-actions {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

.woocommerce-followings-table__cell-followings-actions,
.woocommerce-support-tickets-table__cell-support-tickets-actions,
.woocommerce-enquiry-table__cell-enquiry-actions {
    text-align: center;
    width: 120px;
    min-width: 120px;
}

/* No data messages */
.woocommerce-followings-table__cell-followings-no,
.woocommerce-support-tickets-table__cell-followings-no,
.woocommerce-enquiry-table__cell-enquiry-no {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Touch scroll wrapper */
.touch-scroll-table {
    overflow-x: auto;
    margin: 20px 0;
}

/* Responsive design for WCFM tables */
@media (max-width: 768px) {
    .woocommerce-followings-table,
    .woocommerce-support-tickets-table,
    .woocommerce-enquiry-table {
        font-size: 14px;
    }
    
    .woocommerce-followings-table th,
    .woocommerce-followings-table td,
    .woocommerce-support-tickets-table th,
    .woocommerce-support-tickets-table td,
    .woocommerce-enquiry-table th,
    .woocommerce-enquiry-table td {
        padding: 10px;
    }
    
    .woocommerce-followings-table .wcfm_followings_delete,
    .woocommerce-support-tickets-table .woocommerce-button.button.view,
    .woocommerce-enquiry-table .woocommerce-button.button.view {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .woocommerce-followings-table__header-followings-actions,
    .woocommerce-support-tickets-table__header-support-tickets-actions,
    .woocommerce-enquiry-table__header-enquiry-actions,
    .woocommerce-followings-table__cell-followings-actions,
    .woocommerce-support-tickets-table__cell-support-tickets-actions,
    .woocommerce-enquiry-table__cell-enquiry-actions {
        width: 100px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .woocommerce-followings-table,
    .woocommerce-support-tickets-table,
    .woocommerce-enquiry-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}