/**
 * Gift Reporter for MemberPress - Frontend Styles
 * 
 * @package MemberPressGiftReporter
 */

.mpgr-gift-report {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    margin: 20px 0;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mpgr-gift-report h2 {
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 24px;
}

/* Filter styles */
.mpgr-filters {
    background: #f8f9fa;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mpgr-filters h3 {
    margin-top: 0;
    color: #495057;
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.mpgr-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.mpgr-filter-group {
    display: flex;
    flex-direction: column;
}

.mpgr-filter-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mpgr-filter-group input,
.mpgr-filter-group select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

/* Add dropdown icon for select elements */
.mpgr-filter-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.mpgr-filter-group input:focus,
.mpgr-filter-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    transform: translateY(-1px);
}

/* Ensure dropdown icon remains visible on focus */
.mpgr-filter-group select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230073aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

.mpgr-filter-group input::placeholder {
    color: #6c757d;
    font-style: italic;
}

.mpgr-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.mpgr-filter-actions .button {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mpgr-filter-actions .button-primary {
    background: #0073aa;
    border-color: #0073aa;
}

.mpgr-filter-actions .button-primary:hover {
    background: #005a87;
    border-color: #005a87;
    transform: translateY(-1px);
}

.mpgr-filter-actions .button:not(.button-primary) {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.mpgr-filter-actions .button:not(.button-primary):hover {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
}

.mpgr-active-filters {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #2196f3;
    color: #1976d2;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(33, 150, 243, 0.1);
}

.mpgr-active-filters strong {
    color: #1565c0;
    font-weight: 600;
}

.mpgr-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    margin: 25px 0;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.mpgr-summary h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 18px;
}

.mpgr-summary p {
    margin: 8px 0;
    font-size: 16px;
    line-height: 1.5;
}

.mpgr-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.mpgr-summary-item {
    font-size: 16px;
    padding: 8px 16px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mpgr-export-btn {
    background: #28a745;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 5px;
    display: inline-block;
    margin: 20px 0;
    font-weight: bold;
    font-size: 16px;
    transition: background 0.3s ease;
    border: none;
    cursor: pointer;
}

.mpgr-export-btn:hover {
    background: #218838;
    color: white;
    text-decoration: none;
}

/* Bulk actions */
.mpgr-bulk-actions {
    background: #f8f9fa;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mpgr-bulk-actions--highlight {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.mpgr-bulk-actions .button {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mpgr-bulk-actions .button-primary {
    background: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.mpgr-bulk-actions .button-primary:hover {
    background: #138496;
    border-color: #138496;
    transform: translateY(-1px);
}

.mpgr-bulk-actions .button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.mpgr-selected-count {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    margin-left: auto;
}

/* Checkbox column */
.mpgr-checkbox-col {
    width: 40px;
    text-align: center;
    vertical-align: middle;
}

.mpgr-checkbox-col input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.mpgr-unclaimed-row {
    background-color: #fffbf0;
}

.mpgr-unclaimed-row:hover {
    background-color: #fff8e1;
}

.mpgr-table-wrap {
    width: 100%;
    margin-top: 20px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
}

.mpgr-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 4px;
}

.mpgr-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    background: white;
    min-width: 1280px;
}

.mpgr-table th,
.mpgr-table td {
    border: 1px solid #dcdcde;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.mpgr-table thead th {
    background-color: #2271b1;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

/* Beat wp-admin link colors inside the blue header row */
#wpbody-content .mpgr-gift-report .mpgr-table thead th,
#wpbody-content .mpgr-gift-report .mpgr-table thead th a,
#wpbody-content .mpgr-gift-report .mpgr-table thead th a:visited,
#wpbody-content .mpgr-gift-report .mpgr-table thead th a:hover,
#wpbody-content .mpgr-gift-report .mpgr-table thead th a:focus {
    color: #fff;
    box-shadow: none;
}

#wpbody-content .mpgr-gift-report .mpgr-table thead th a {
    text-decoration: none;
    font-weight: 600;
}

#wpbody-content .mpgr-gift-report .mpgr-table thead th a:hover,
#wpbody-content .mpgr-gift-report .mpgr-table thead th a:focus {
    text-decoration: underline;
    color: #fff;
}

.mpgr-presets {
    margin: 0 0 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mpgr-result-count {
    margin: 12px 0;
    color: #50575e;
}

.mpgr-table thead th[aria-sort="ascending"] .mpgr-sort-link::after,
.mpgr-table thead th[aria-sort="descending"] .mpgr-sort-link::after {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.9;
}

.mpgr-table thead th[aria-sort="ascending"] .mpgr-sort-link::after {
    content: "▲";
}

.mpgr-table thead th[aria-sort="descending"] .mpgr-sort-link::after {
    content: "▼";
}

#wpbody-content .mpgr-gift-report .mpgr-table tbody td {
    color: #1d2327;
}

#wpbody-content .mpgr-gift-report .mpgr-table tbody td a,
#wpbody-content .mpgr-gift-report .mpgr-table tbody td a:visited {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

#wpbody-content .mpgr-gift-report .mpgr-table tbody td a:hover,
#wpbody-content .mpgr-gift-report .mpgr-table tbody td a:focus {
    color: #135e96;
    text-decoration: underline;
}

.mpgr-table .mpgr-col-nowrap {
    white-space: nowrap;
}

.mpgr-table .mpgr-col-email {
    min-width: 200px;
    max-width: 240px;
    word-break: break-word;
}

.mpgr-table .mpgr-col-coupon {
    min-width: 150px;
    max-width: 200px;
    font-size: 12px;
    word-break: break-all;
}

.mpgr-table .mpgr-col-product {
    min-width: 130px;
}

.mpgr-table .mpgr-col-id {
    min-width: 110px;
    white-space: nowrap;
}

.mpgr-table .mpgr-col-actions {
    white-space: nowrap;
    width: 72px;
    text-align: center;
}

.mpgr-table .mpgr-checkbox-col {
    width: 36px;
    text-align: center;
    white-space: nowrap;
}

.mpgr-pagination {
    margin-top: 16px;
}

.mpgr-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.mpgr-table tr:hover {
    background-color: #f0f0f0;
}

.mpgr-claimed {
    color: #28a745;
    font-weight: bold;
}

.mpgr-unclaimed {
    color: #ffc107;
    font-weight: bold;
}

.mpgr-refunded {
    color: #dc3545;
    font-weight: bold;
}

.mpgr-deleted-user {
    color: #ffffff;
    font-style: italic;
    background-color: #dc3545;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #c82333;
    font-size: 12px;
}

.mpgr-deleted-coupon {
    color: #ffffff;
    font-style: italic;
    background-color: #dc3545;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #c82333;
    font-size: 12px;
}

/* Marks a gift whose reminder log contains a failed send. */
.mpgr-reminder-failed {
    color: #dc3545;
    font-weight: bold;
    margin-left: 4px;
    cursor: help;
}

/* Per-membership breakdown */
.mpgr-breakdown,
.mpgr-trend {
    margin: 25px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.mpgr-breakdown h3,
.mpgr-trend h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 18px;
}

.mpgr-breakdown-table {
    min-width: 0;
}

/* Purchases vs claims trend */
.mpgr-trend-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #495057;
}

.mpgr-trend-key::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: -1px;
}

.mpgr-trend-key--purchases::before {
    background: #2271b1;
}

.mpgr-trend-key--claims::before {
    background: #28a745;
}

.mpgr-trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    overflow-x: auto;
    padding-top: 4px;
}

.mpgr-trend-day {
    flex: 1 0 14px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    cursor: help;
}

.mpgr-trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    width: 100%;
    height: 100%;
}

.mpgr-trend-bar {
    display: block;
    flex: 1;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
}

.mpgr-trend-bar--purchases {
    background: #2271b1;
}

.mpgr-trend-bar--claims {
    background: #28a745;
}

/* Action buttons */
.mpgr-actions {
    white-space: nowrap;
    text-align: center;
}

.mpgr-actions:not(:empty) {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.mpgr-action-btn {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mpgr-action-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 115, 170, 0.3);
}

.mpgr-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 115, 170, 0.3);
}

.mpgr-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mpgr-action-btn.mpgr-loading {
    animation: pulse 1s infinite;
}

.mpgr-action-btn.mpgr-success {
    background: #28a745;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.mpgr-resend-email {
    background: #17a2b8;
}

.mpgr-resend-email:hover {
    background: #138496;
}

.mpgr-copy-link {
    background: #6f42c1;
}

.mpgr-copy-link:hover {
    background: #5a32a3;
}

.mpgr-no-data {
    text-align: center;
    padding: 60px 40px;
    color: #6c757d;
    font-size: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin: 30px 0;
    border: 2px dashed #dee2e6;
    position: relative;
    overflow: hidden;
}

.mpgr-no-data::before {
    content: "🎁";
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.7;
}

.mpgr-no-data h3 {
    color: #495057;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mpgr-no-data p {
    color: #6c757d;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 25px 0;
}

.mpgr-no-data ul {
    text-align: left;
    max-width: 450px;
    margin: 0 auto;
    background: white;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-left: 4px solid #0073aa;
}

.mpgr-no-data li {
    margin: 12px 0;
    padding-left: 25px;
    position: relative;
    color: #495057;
    font-weight: 500;
}

.mpgr-no-data li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
}

.mpgr-no-data .mpgr-help-links {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #dee2e6;
}

.mpgr-no-data .mpgr-help-links a {
    display: inline-block;
    margin: 0 10px;
    padding: 8px 16px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mpgr-no-data .mpgr-help-links a:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

/* Filtered no-data state */
.mpgr-filtered-no-data {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
}

.mpgr-filtered-no-data::before {
    content: "🔍";
    color: #856404;
}

.mpgr-filtered-no-data h3 {
    color: #856404;
}

.mpgr-filtered-no-data p {
    color: #856404;
}

.mpgr-filtered-no-data ul {
    background: white;
    border-left-color: #ffc107;
}

.mpgr-filtered-no-data li {
    color: #856404;
}

.mpgr-filtered-no-data li::before {
    color: #ffc107;
}

.mpgr-clear-filters-btn {
    background: #ffc107 !important;
    color: #212529 !important;
    border-color: #ffc107 !important;
}

.mpgr-clear-filters-btn:hover {
    background: #e0a800 !important;
    border-color: #e0a800 !important;
    color: #212529 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .mpgr-gift-report {
        padding: 15px;
        margin: 10px 0;
    }
    
    .mpgr-filters {
        padding: 20px;
    }
    
    .mpgr-filter-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .mpgr-filter-group input,
    .mpgr-filter-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .mpgr-filter-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .mpgr-filter-actions .button {
        width: 100%;
        text-align: center;
    }
    
    .mpgr-no-data {
        padding: 40px 20px;
    }
    
    .mpgr-no-data h3 {
        font-size: 20px;
    }
    
    .mpgr-no-data ul {
        padding: 20px 25px;
    }
    
    .mpgr-no-data .mpgr-help-links {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .mpgr-no-data .mpgr-help-links a {
        margin: 0;
        text-align: center;
    }
    
    .mpgr-table {
        font-size: 12px;
    }
    
    .mpgr-table th,
    .mpgr-table td {
        padding: 8px 5px;
    }
    
    .mpgr-actions:not(:empty) {
        gap: 2px;
    }
    
    .mpgr-action-btn {
        padding: 4px 6px;
        margin: 0;
        font-size: 12px;
        min-width: 28px;
        height: 28px;
    }
    
    .mpgr-summary {
        padding: 15px;
    }
    
    .mpgr-summary p {
        font-size: 14px;
    }
    
    .mpgr-summary-row {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .mpgr-summary-item {
        font-size: 14px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .mpgr-table-wrap {
        margin-top: 16px;
    }

    .mpgr-table {
        min-width: 1100px;
    }
    
    .mpgr-export-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}
