/* Amazon Affiliate Tracker v3.0 - Combined Styles */

/* =============================================================================
   FRONTEND STYLES - ENHANCED COMPATIBILITY
   ============================================================================= */

.buy-from-amazon {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    clear: both;
    overflow: hidden;
    box-sizing: border-box;
}

.amazon-availability-text {
    color: #333;
    font-size: 16px;
    margin: 0 0 15px 0;
    font-weight: 500;
    line-height: 1.5;
}

.amazon-buy-button {
    background: #232f3e !important;
    color: #fff !important;
    border: none !important;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: all .3s ease;
    text-decoration: none !important;
    min-height: 2rem;
    border-radius: 4px;
    box-shadow: none !important;
    outline: none !important;
    gap: 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.amazon-buy-button:hover,
.amazon-buy-button:focus {
    background: #131a22 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
    text-decoration: none !important;
}

.amazon-buy-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.amazon-buy-button::before {
    content: "\2192" !important;
    font-size: 1rem;
    margin-right: .25rem;
    display: inline-block;
}

.amazon-logo {
    height: 1.2rem !important;
    width: auto !important;
    max-height: 1.7rem;
    max-width: 80px;
    vertical-align: middle;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Shortcode specific styles */
.buy-from-amazon.aat-shrtcd {
    width: 95%;
    max-width: 35rem;
    margin: 2rem auto 4rem auto;
    padding: 2rem;
}

.amazon-buy-button.aat-shrtcd {
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    min-width: 200px;
}

/* Loading state */
.amazon-buy-button.loading {
    opacity: 0.7;
    cursor: not-allowed !important;
    pointer-events: none;
}

.amazon-buy-button.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: aat-spin 1s linear infinite;
    margin-left: 8px;
}

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

/* Theme compatibility fixes */
.buy-from-amazon * {
    box-sizing: border-box;
}

/* Override common theme button styles */
.buy-from-amazon .amazon-buy-button {
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    font-family: inherit !important;
    background-image: none !important;
    border-style: none !important;
    border-width: 0 !important;
    margin: 0 auto !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .buy-from-amazon {
        margin: 15px 0;
        padding: 15px;
    }

    .amazon-availability-text {
        font-size: 14px;
    }

    .amazon-buy-button {
        padding: 12px 20px !important;
        font-size: 14px !important;
        width: 100% !important;
        max-width: 300px;
    }

    .amazon-logo {
        height: 16px !important;
    }
    
    .buy-from-amazon.aat-shrtcd {
        padding: 1rem;
        margin: 1rem auto 2rem auto;
    }
}

@media (max-width: 480px) {
    .amazon-buy-button {
        font-size: 13px !important;
        padding: 10px 16px !important;
    }
    
    .amazon-buy-button::before {
        font-size: 14px;
    }
}

/* =============================================================================
   ADMIN STYLES
   ============================================================================= */

/* Product Meta Box Styles */
.amazon-affiliate-meta-box {
    padding: 15px 0;
}

.amazon-affiliate-meta-box label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: #1d2327;
    font-size: 14px;
}

.amazon-affiliate-meta-box input[type="url"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.amazon-affiliate-meta-box input[type="url"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

.amazon-affiliate-meta-box .description {
    font-style: italic;
    color: #646970;
    margin-top: 6px;
    font-size: 13px;
}

.amazon-stats {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 1px solid #c3d9ff;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.amazon-stats strong {
    color: #0073aa;
}

/* Dashboard Widget */
.amazon-affiliate-dashboard-widget .widefat {
    margin-top: 10px;
}

.amazon-affiliate-dashboard-widget .widefat th,
.amazon-affiliate-dashboard-widget .widefat td {
    padding: 8px;
}

.amazon-affiliate-dashboard-widget .widefat tfoot th {
    border-top: 2px solid #ddd;
    font-weight: bold;
}

/* Analytics Summary Stats */
.aat-summary-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.aat-stat-card {
    background: #fff;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    flex: 1;
    min-width: 200px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: box-shadow 0.3s ease;
}

.aat-stat-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aat-stat-card h3 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aat-stat-card .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

/* Countries Widget */
.aat-countries-widget {
    background: #fff;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin: 20px 0;
}

.aat-countries-widget h3 {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 16px;
}

.countries-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.country-item {
    text-align: center;
    min-width: 100px;
}

.country-clicks {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
}

.country-name {
    font-size: 12px;
    color: #666;
    margin: 4px 0;
}

.country-visitors {
    font-size: 11px;
    color: #999;
}

/* Analytics Filters */
.tablenav .actions input,
.tablenav .actions select {
    margin-right: 8px;
}

.tablenav .actions input[type="date"] {
    max-width: 140px;
}

.tablenav .actions input[type="text"] {
    max-width: 120px;
}

/* Table Styles */
.wp-list-table th,
.wp-list-table td {
    padding: 12px 8px;
    vertical-align: top;
}

.wp-list-table code {
    background: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
}

.wp-list-table .no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

.wp-list-table .unknown {
    color: #999;
}

.wp-list-table .click-count {
    color: #0073aa;
}

.wp-list-table .time-diff {
    color: #28a745;
}

.wp-list-table .shortcode-indicator {
    color: #e74c3c;
    font-weight: bold;
}

.wp-list-table .same-referer {
    color: #999;
}

.wp-list-table .direct {
    color: #666;
}

.wp-list-table .referer-link {
    max-width: 150px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.wp-list-table .referer-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .aat-summary-stats {
        flex-direction: column;
    }
    
    .aat-stat-card {
        margin-bottom: 10px;
        min-width: auto;
    }
    
    .countries-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .tablenav .actions {
        margin-bottom: 10px;
    }
    
    .tablenav .actions input,
    .tablenav .actions select {
        margin-bottom: 5px;
        width: 100%;
        max-width: none;
    }
    
    .wp-list-table {
        font-size: 12px;
    }
    
    .wp-list-table th,
    .wp-list-table td {
        padding: 8px 4px;
    }
}