/* Bling WooCommerce Integration - Frontend Styles */
/* Paleta Roxo Premium: #4A1A5C (escuro), #602D8F (principal), #7B4397 (médio), #9B59B6 (claro) */

/* Reset e configurações base */
* {
    box-sizing: border-box;
}

/* OAuth Integration Page */
.bling-oauth-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bling-oauth-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 1px 3px rgba(96, 45, 143, 0.06),
        0 4px 12px rgba(96, 45, 143, 0.04),
        inset 0 0 0 1px rgba(96, 45, 143, 0.08);
    padding: 40px;
    text-align: center;
    position: relative;
    border: 1.5px solid rgba(96, 45, 143, 0.12);
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bling-oauth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #602D8F, #7B4397, #9B59B6);
    border-radius: 16px 16px 0 0;
}

.bling-oauth-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 32px rgba(96, 45, 143, 0.12),
        0 16px 48px rgba(96, 45, 143, 0.08),
        inset 0 0 0 1.5px rgba(123, 67, 151, 0.2);
    border-color: rgba(123, 67, 151, 0.25);
}

.bling-header {
    margin-bottom: 30px;
}

.bling-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 8px rgba(96, 45, 143, 0.15));
}

.bling-header h2 {
    background: linear-gradient(135deg, #602D8F 0%, #FFB347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

.bling-status {
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.bling-status.connected {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.95) 0%, rgba(123, 67, 151, 0.95) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(96, 45, 143, 0.25);
}

/* Success Page Styles */
.bling-status.success-page {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95) 0%, rgba(16, 185, 129, 0.95) 100%);
    color: white;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
    text-align: left;
    padding: 40px;
}

.success-header {
    text-align: center;
    margin-bottom: 40px;
}

.success-icon {
    font-size: 64px !important;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.success-header h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: white;
}

.success-message {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

.success-features {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-text h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: white;
}

.feature-text p {
    font-size: 14px;
    margin: 0;
    opacity: 0.9;
    line-height: 1.4;
}

.success-actions {
    text-align: center;
    margin-bottom: 30px;
}

.catalog-btn {
    display: inline-block;
    background: linear-gradient(135deg, #FFB347 0%, #FF8C42 100%);
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(255, 179, 71, 0.4);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.catalog-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 179, 71, 0.5);
    color: white;
    text-decoration: none;
}

.action-description {
    margin-top: 15px;
    font-size: 14px;
    opacity: 0.9;
}

.additional-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.additional-actions .btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.additional-actions .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sale-price-input {
    border: 2px solid #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15) !important;
    background: #f0fff4;
}
.sale-price-input:focus,
.sale-price-input:hover,
.sale-price-input:active {
    border-color: #22c55e !important;
    outline: none;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25) !important;
}
/* Forçar prioridade sobre temas globais */
.product-edit-form input#product_price.sale-price-input,
.product-edit-form input#product_price.sale-price-input:focus,
.product-edit-form input#product_price.sale-price-input:hover,
.product-edit-form input#product_price.sale-price-input:active {
    border: 2px solid #22c55e !important;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25) !important;
    background: #f0fff4;
}

.bling-status.disconnected {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
    border: 2px solid rgba(96, 45, 143, 0.15);
    color: #602D8F;
}

.status-icon {
    font-size: 48px;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.bling-status h3 {
    font-size: 24px;
    margin: 0 0 10px 0;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.bling-status p {
    font-size: 16px;
    margin: 0 0 20px 0;
    opacity: 0.9;
    line-height: 1.5;
}

.bling-benefits {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    border: 1px solid rgba(96, 45, 143, 0.1);
}

.bling-benefits h4 {
    color: #602D8F;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    font-family: 'Montserrat', sans-serif;
}

.bling-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.bling-benefits li {
    padding: 10px 0;
    position: relative;
    padding-left: 30px;
    color: #4A1A5C;
    font-weight: 500;
}

.bling-benefits li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #602D8F;
    font-weight: bold;
    font-size: 16px;
    background: linear-gradient(135deg, #602D8F, #7B4397);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bling-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-width: 140px;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(96, 45, 143, 0.15);
}

.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;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #602D8F 0%, #7B4397 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4A1A5C 0%, #602D8F 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(96, 45, 143, 0.3);
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
    color: #602D8F;
    border: 2px solid rgba(96, 45, 143, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.15) 0%, rgba(155, 89, 182, 0.15) 100%);
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(96, 45, 143, 0.5);
    color: #4A1A5C;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(96, 45, 143, 0.2);
}

.btn-large {
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 700;
    min-width: 180px;
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
    min-width: 100px;
    font-weight: 600;
}

/* Danger (destrutivo) */
.btn-danger {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: #fff;
    border: 2px solid #b71c1c;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.3);
    color: #fff;
    text-decoration: none;
}

/* Catalog Page */
.bling-catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
    border-radius: 16px;
    min-height: 100vh;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 
        0 1px 3px rgba(96, 45, 143, 0.06),
        0 4px 12px rgba(96, 45, 143, 0.04),
        inset 0 0 0 1px rgba(96, 45, 143, 0.08);
    border: 1.5px solid rgba(96, 45, 143, 0.12);
}

.catalog-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #602D8F, #7B4397, #9B59B6);
    border-radius: 16px 16px 0 0;
}

.catalog-header h2 {
    background: linear-gradient(135deg, #602D8F 0%, #FFB347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
}

.catalog-search {
    flex: 1;
    max-width: 400px;
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(96, 45, 143, 0.2);
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.search-form input[type="text"]:focus {
    border-color: #602D8F;
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 45, 143, 0.1);
    background: #ffffff;
}

.catalog-actions {
    display: flex;
    gap: 12px;
}

.bulk-actions {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.05) 0%, rgba(155, 89, 182, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(96, 45, 143, 0.15);
}

.bulk-actions label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #602D8F;
    font-family: 'Montserrat', sans-serif;
}

/* Catalog header and filters (compact for 4-col grid) */
.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.catalog-header .catalog-title {
    font-size: 18px;
    margin: 0 0 4px 0;
}
.catalog-header .results-count {
    font-size: 12px;
    color: #6b7280;
}
.filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filters-bar input[type="text"],
.filters-bar input[type="number"],
.filters-bar select {
    height: 30px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}
.filters-bar .btn {
    height: 30px;
    padding: 6px 10px;
    font-size: 12px;
}


.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.product-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 1px 3px rgba(96, 45, 143, 0.06),
        0 4px 12px rgba(96, 45, 143, 0.04),
        inset 0 0 0 1px rgba(96, 45, 143, 0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1.5px solid rgba(96, 45, 143, 0.12);
    backdrop-filter: blur(10px);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #602D8F, #7B4397, #9B59B6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 8px 32px rgba(96, 45, 143, 0.12),
        0 16px 48px rgba(96, 45, 143, 0.08),
        inset 0 0 0 1.5px rgba(123, 67, 151, 0.2);
    border-color: rgba(123, 67, 151, 0.25);
}

.product-card:hover::before {
    opacity: 1;
}

.product-card.synced {
    border-color: rgba(96, 45, 143, 0.3);
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
}

.product-select {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.product-select input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #602D8F;
}

.product-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-image img {
    transform: scale(1.03);
}

.product-info {
    padding: 14px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #4A1A5C;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #602D8F, #7B4397);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 6px 0;
}

.product-sku,
.product-stock {
    font-size: 12px;
    color: #7B4397;
    margin: 4px 0;
    font-weight: 500;
}

.product-actions {
    padding: 14px;
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
    display: flex;
    gap: 8px;
    justify-content: space-between;
    flex-wrap: wrap;
    border-top: 1px solid rgba(96, 45, 143, 0.1);
}

/* Ajustes de botões dentro do card para evitar overflow */
.products-grid .product-actions .btn {
    width: auto;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
}
.products-grid .product-actions .btn-small {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 0;
}

.product-card.hidden { display: none; }

/* Product Edit Page */
.bling-product-edit-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.edit-header {
    text-align: center;
    margin-bottom: 40px;
}

.edit-header h2 {
    color: #333;
    font-size: 32px;
    margin: 0 0 10px 0;
}

.edit-header p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

.product-edit-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #007cba;
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.col-md-3 { flex: 0 0 25%; }
.col-md-4 { flex: 0 0 33.333%; }
.col-md-8 { flex: 0 0 66.666%; }

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

/* Notices */
.bling-notice {
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1.5px solid;
}

.bling-notice.banner {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    width: 100%;
    margin-top: 15px;
}

.bling-notice::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

.bling-notice.warning {
    background: linear-gradient(135deg, rgba(255, 179, 71, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    border-color: rgba(255, 179, 71, 0.3);
    color: #8B4513;
}

.bling-notice.warning::before {
    background: linear-gradient(90deg, #FFB347, #FFC107);
}

.bling-notice.success {
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.1) 0%, rgba(123, 67, 151, 0.05) 100%);
    border-color: rgba(96, 45, 143, 0.3);
    color: #4A1A5C;
}

.bling-notice.success::before {
    background: linear-gradient(90deg, #602D8F, #7B4397);
}

.bling-notice.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(248, 215, 218, 0.3) 100%);
    border-color: rgba(220, 53, 69, 0.3);
    color: #721c24;
}

.bling-notice.error::before {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

/* Footer */
.bling-footer {
    margin-top: 40px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(96, 45, 143, 0.02) 0%, rgba(155, 89, 182, 0.02) 100%);
    border-radius: 12px;
    border: 1px solid rgba(96, 45, 143, 0.1);
    text-align: center;
}

.bling-footer p {
    margin: 0;
    color: #7B4397;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
}

.bling-footer a {
    color: #602D8F;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.bling-footer a:hover {
    color: #4A1A5C;
    text-decoration: underline;
}

/* User Info */
.user-info {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(96, 45, 143, 0.15);
    backdrop-filter: blur(10px);
}

.user-info p {
    margin: 8px 0;
    color: #4A1A5C;
    font-weight: 500;
}

/* Pagination */
.catalog-pagination {
    text-align: center;
    margin-top: 40px;
}

.catalog-pagination .page-numbers {
    display: inline-block;
    padding: 12px 16px;
    margin: 0 6px;
    text-decoration: none;
    border: 2px solid rgba(96, 45, 143, 0.2);
    border-radius: 8px;
    color: #602D8F;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

.catalog-pagination .page-numbers:hover,
.catalog-pagination .page-numbers.current {
    background: linear-gradient(135deg, #602D8F 0%, #7B4397 100%);
    color: white;
    border-color: #602D8F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 45, 143, 0.25);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .catalog-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .catalog-search {
        max-width: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .col-md-3,
    .col-md-4,
    .col-md-8 {
        flex: none;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .bling-oauth-card {
        padding: 20px;
    }
    
    .product-edit-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .bling-actions {
        flex-direction: column;
    }
}