/* RMA Shippo Plugin Styles - Namespaced for conflict prevention */

/* Import Poppins font if not already loaded */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Base plugin styles with specific namespace to prevent theme conflicts */
.rma-shippo-plugin *,
.rma-shippo-plugin *:before,
.rma-shippo-plugin *:after {
    box-sizing: border-box;
}

.rma-shippo-plugin {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.6;
    /* Reset common conflicting styles */
    text-transform: none !important;
    font-weight: normal !important;
    text-decoration: none !important;
}

/* Ensure our plugin content doesn't inherit unwanted styles */
.rma-shippo-plugin div,
.rma-shippo-plugin span,
.rma-shippo-plugin p,
.rma-shippo-plugin table,
.rma-shippo-plugin th,
.rma-shippo-plugin td,
.rma-shippo-plugin button {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    vertical-align: baseline;
    background: transparent;
    box-sizing: border-box;
}

.rma-shippo-container {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Return label button styling - highly specific to prevent conflicts */
.rma-shippo-plugin .rma-print-label-btn,
.rma-print-label-btn.rma-print-label-btn {
    background: linear-gradient(135deg, #005fcc 0%, #004bb5 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(0, 95, 204, 0.2);
    position: relative;
    overflow: hidden;
}

.rma-print-label-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.rma-print-label-btn:hover:before {
    left: 100%;
}

.rma-print-label-btn:hover {
    background: linear-gradient(135deg, #0056b8 0%, #003a96 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 95, 204, 0.4);
}

.rma-print-label-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 95, 204, 0.3);
}

.rma-print-label-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.rma-print-label-btn:disabled:before {
    display: none;
}

/* Return label download link */
.rma-label-download {
    margin-top: 12px;
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.rma-label-download a {
    color: #005fcc;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: rgba(0, 95, 204, 0.1);
}

.rma-label-download a:hover {
    background: rgba(0, 95, 204, 0.2);
    color: #004bb5;
    transform: translateY(-1px);
}

/* Loading overlay */
.rma-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}

.rma-loading-overlay > div {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    text-align: center;
    animation: fadeInScale 0.3s ease-out;
}

.rma-loading-overlay .loading-title {
    margin-bottom: 12px;
    font-weight: 600;
    color: #005fcc;
    font-size: 16px;
}

.rma-loading-overlay .loading-text {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Notifications */
.rma-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    cursor: pointer;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.rma-notification:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Table enhancements - specifically target our plugin tables */
.rma-shippo-plugin table[style*="border-collapse: collapse"],
table.rma-shippo-table {
    border-spacing: 0 !important;
    width: 100% !important;
    font-family: 'Poppins', sans-serif !important;
}

.rma-shippo-plugin table[style*="border-collapse: collapse"] tbody tr:hover,
table.rma-shippo-table tbody tr:hover {
    background: rgba(0, 95, 204, 0.05) !important;
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.rma-shippo-plugin table[style*="border-collapse: collapse"] tbody tr,
table.rma-shippo-table tbody tr {
    transition: all 0.2s ease;
}

/* Status badges */
span[style*="background:"][style*="color: white"] {
    display: inline-block;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

span[style*="background:"][style*="color: white"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Info box enhancements */
div[style*="background: linear-gradient"][style*="border-left: 5px solid #005fcc"] {
    position: relative;
    overflow: hidden;
}

div[style*="background: linear-gradient"][style*="border-left: 5px solid #005fcc"]:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, #005fcc, #004bb5);
    box-shadow: 2px 0 4px rgba(0, 95, 204, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .rma-print-label-btn {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .rma-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        margin: 0;
    }
    
    .rma-loading-overlay > div {
        margin: 0 20px;
        padding: 20px;
    }
    
    table[style*="border-collapse: collapse"] {
        font-size: 12px;
    }
    
    table[style*="border-collapse: collapse"] th,
    table[style*="border-collapse: collapse"] td {
        padding: 8px 6px !important;
    }
}

@media (max-width: 480px) {
    .rma-print-label-btn {
        padding: 12px;
        font-size: 12px;
    }
    
    .rma-loading-overlay .loading-title {
        font-size: 14px;
    }
    
    .rma-loading-overlay .loading-text {
        font-size: 12px;
    }
    
    /* Make table horizontally scrollable on very small screens */
    div[style*="overflow: hidden"] {
        overflow-x: auto !important;
    }
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Print styles */
@media print {
    .rma-print-label-btn,
    .rma-label-download,
    .rma-notification,
    .rma-loading-overlay {
        display: none !important;
    }
    
    table[style*="border-collapse: collapse"] {
        border: 1px solid #000 !important;
    }
    
    table[style*="border-collapse: collapse"] th,
    table[style*="border-collapse: collapse"] td {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}

/* Admin page styles */
.rma-shippo-admin {
    max-width: 800px;
}

.rma-shippo-admin .form-table th {
    padding-left: 0;
}

.rma-shippo-admin .form-table td {
    padding-left: 20px;
}

#test-shippo-connection {
    background: #005fcc;
    border-color: #005fcc;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 95, 204, 0.2);
    transition: all 0.2s ease;
}

#test-shippo-connection:hover {
    background: #004bb5;
    border-color: #004bb5;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 95, 204, 0.3);
}

#test-result .notice {
    margin: 10px 0;
    padding: 12px;
    border-radius: 6px;
}

/* Focus styles for accessibility */
.rma-print-label-btn:focus {
    outline: 3px solid rgba(0, 95, 204, 0.3);
    outline-offset: 2px;
}

.rma-label-download a:focus {
    outline: 2px solid rgba(0, 95, 204, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .rma-print-label-btn {
        border: 2px solid;
    }
    
    .rma-notification {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .rma-print-label-btn,
    .rma-label-download a,
    .rma-notification,
    table[style*="border-collapse: collapse"] tbody tr {
        transition: none;
    }
    
    .rma-print-label-btn:before {
        display: none;
    }
    
    @keyframes slideInRight {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    
    @keyframes fadeInScale {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .rma-loading-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .rma-loading-overlay > div {
        background: #1a1a1a;
        color: white;
        border: 1px solid #333;
    }
    
    .rma-loading-overlay .loading-title {
        color: #66b3ff;
    }
    
    .rma-loading-overlay .loading-text {
        color: #ccc;
    }
}

/* Elementor conflict prevention */
.elementor-widget-container .rma-shippo-plugin,
.elementor-section .rma-shippo-plugin,
.elementor-column .rma-shippo-plugin {
    /* Reset Elementor's global styles that might interfere */
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: inherit !important;
}

.elementor-widget-container .rma-print-label-btn,
.elementor-section .rma-print-label-btn,
.elementor-column .rma-print-label-btn {
    /* Ensure button styles aren't overridden by Elementor */
    background: linear-gradient(135deg, #005fcc 0%, #004bb5 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-size: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: 0.3px !important;
    box-shadow: 0 2px 8px rgba(0, 95, 204, 0.2) !important;
}

/* Page builder compatibility */
.vc_row .rma-shippo-plugin,
.et_pb_section .rma-shippo-plugin,
.fusion-row .rma-shippo-plugin,
.elementor-section .rma-shippo-plugin {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Prevent theme interference */
.rma-shippo-plugin * {
    font-family: inherit !important;
}

.rma-shippo-plugin table,
.rma-shippo-plugin th,
.rma-shippo-plugin td {
    border-collapse: collapse !important;
    background: none !important;
}

/* Override common theme button styles */
.rma-shippo-plugin button,
.rma-shippo-plugin .rma-print-label-btn {
    background-image: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 95, 204, 0.2) !important;
    text-shadow: none !important;
    font-family: 'Poppins', sans-serif !important;
}

/* Admin compatibility */
.rma-admin-table {
    margin-top: 20px;
}

.rma-admin-table th {
    font-weight: 600;
    color: #23282d;
}

.rma-compatibility-status {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
}

.rma-compatibility-status p {
    margin: 8px 0;
    font-size: 14px;
} 