/* Hide connection toggle on edit pages */
body.wp-admin #uic-connections-toggle-container,
body .invoice-container #uic-connections-toggle-container {
    display: none !important;
}

/* Ensure it's visible on main pages */
body #uic-connections-toggle-container {
    display: block !important;
}
/* === SHOPIFY CONNECTION PAGE CSS === */
.uic-shopify-connect-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.uic-shopify-header {
    margin-bottom: 30px;
}

.uic-shopify-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #95BF47 0%, #95BF47 50%, #5E8E3E 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(149, 191, 71, 0.3);
}

.uic-shopify-logo svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.uic-shopify-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.uic-shopify-subtitle {
    font-size: 16px;
    color: #7f8c8d;
    line-height: 1.6;
}

.uic-shopify-form {
    margin-top: 30px;
}

.uic-form-group {
    margin-bottom: 25px;
    text-align: left;
}

.uic-form-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.uic-form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.uic-form-input:focus {
    outline: none;
    border-color: #95BF47;
    box-shadow: 0 0 0 3px rgba(149, 191, 71, 0.1);
}

.uic-form-input::placeholder {
    color: #bdc3c7;
}

.uic-shopify-button {
    background: linear-gradient(135deg, #95BF47 0%, #5E8E3E 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.uic-shopify-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(149, 191, 71, 0.4);
}

.uic-shopify-button:active {
    transform: translateY(0);
}

.uic-shopify-features {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #ecf0f1;
}

.uic-features-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
}

.uic-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    text-align: left;
}

.uic-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #7f8c8d;
}

.uic-feature-icon {
    color: #95BF47;
    font-weight: bold;
}

.uic-shopify-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
    font-size: 14px;
    color: #bdc3c7;
}

.uic-back-link {
    display: inline-block;
    margin-top: 20px;
    color: #95BF47;
    text-decoration: none;
    font-weight: 500;
}

.uic-back-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .uic-shopify-connect-container {
        margin: 20px;
        padding: 30px 20px;
    }

    .uic-shopify-title {
        font-size: 24px;
    }

    .uic-features-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading state */
.uic-shopify-button.loading {
    position: relative;
    color: transparent;
}

.uic-shopify-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- NEW: Styles for Connection Toggle --- */
#uic-connections-toggle-container {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
#uic-connections-header {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    background-color: #f6f7f7;
    user-select: none;
}
#uic-connections-header.connected {
    background-color: #eaf7ed;
    color: #2b6e44;
}
#uic-connections-header.disconnected {
    background-color: #fff8e5;
    color: #8a6d3b;
}
.uic-toggle-arrow {
    transition: transform 0.3s ease;
}
#uic-connections-header.open .uic-toggle-arrow {
    transform: rotate(180deg);
}
#uic-connections-panel {
    padding: 15px;
    border-top: 1px solid #ddd;
    display: none; /* Initially hidden */
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --light: #ecf0f1;
    --dark: #34495e;
    --success: #27ae60;
    --warning: #f39c12;
    --gray: #95a5a6;
    --light-gray: #f8f9fa;
    --border: #ddd;
}

.invoice-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.invoice-header {
    background: var(--primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invoice-title {
    font-size: 22px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.back-button {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.back-button:hover {
    background: #2980b9;
    color: white;
}

.invoice-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    background: var(--light-gray);
    border-bottom: 1px solid var(--border);
}

.info-group {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
    font-size: 14px;
}

.info-value {
    font-size: 16px;
    padding: 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 100%;
}

.tools-section {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--secondary);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--light-gray);
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid var(--secondary);
}

.tool-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--secondary);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #219653;
}

.items-section {
    padding: 20px;
}

/* Table Container for Scrollability */
.table-container {
    overflow-x: auto;
    max-width: 100%;
    margin: 15px 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    -webkit-overflow-scrolling: touch;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1300px; /* Minimum width to accommodate all columns */
}

.items-table th {
    background: var(--primary);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.items-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.items-table tr:nth-child(even) {
    background: var(--light-gray);
}

.items-table tr:hover {
    background: #f0f8ff;
}

.items-table input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.items-table input:focus {
    border-color: var(--secondary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.items-table .tags-input {
    min-width: 120px;
}

/* Column Widths */
.items-table th:nth-child(1),
.items-table td:nth-child(1) { min-width: 80px; max-width: 100px; } /* SKU */
.items-table th:nth-child(2),
.items-table td:nth-child(2) { min-width: 150px; max-width: 200px; } /* Description */
.items-table th:nth-child(3),
.items-table td:nth-child(3) { min-width: 60px; max-width: 80px; } /* Qty */
.items-table th:nth-child(4),
.items-table td:nth-child(4) { min-width: 80px; max-width: 100px; } /* Cost */
.items-table th:nth-child(5),
.items-table td:nth-child(5) { min-width: 80px; max-width: 100px; } /* Price */
.items-table th:nth-child(6),
.items-table td:nth-child(6) { min-width: 100px; max-width: 130px; } /* Collection */
.items-table th:nth-child(7),
.items-table td:nth-child(7) { min-width: 120px; max-width: 150px; } /* Tags */
.items-table th:nth-child(8),
.items-table td:nth-child(8) { min-width: 80px; max-width: 100px; } /* MPN */
.items-table th:nth-child(9),
.items-table td:nth-child(9) { min-width: 80px; max-width: 100px; } /* GTIN */
.items-table th:nth-child(10),
.items-table td:nth-child(10) { min-width: 100px; max-width: 130px; } /* Vendor */
/* This correctly hides only the column with the 'hidden-column' class */
.items-table .hidden-column {
    display: none;
}
.items-table th:nth-child(12),
.items-table td:nth-child(12) { min-width: 120px; max-width: 150px; } /* Variant Title */
.items-table th:nth-child(13),
.items-table td:nth-child(13) { min-width: 100px; max-width: 130px; } /* Variant Barcode */
.items-table th:nth-child(14),
.items-table td:nth-child(14) { min-width: 60px; max-width: 70px; text-align: center; } /* Actions */

/* Remove Button Styling */
.remove-row {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.remove-row:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--light-gray);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}

.export-options {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.credit-cost {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
}

.hidden-column {
    display: none;
}

/* Scrollbar Styling for Table Container */
.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

@media (max-width: 1400px) {
    .invoice-container {
        margin: 0 20px;
        width: calc(100% - 40px);
    }
}

@media (max-width: 992px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .invoice-info-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .export-options {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .invoice-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .items-table th,
    .items-table td {
        padding: 8px 6px;
    }
    
    .items-table input {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .remove-row {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .input-group {
        flex-direction: column;
    }
    
    .tools-section {
        padding: 15px;
    }
    
    .tool-card {
        padding: 12px;
    }
}
/* --- Styles for Background Processing Notice --- */

.uic-processing-notice {
    /* Layout */
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;

    /* Appearance */
    background-color: #eaf5ff; /* Light blue background */
    border: 1px solid #b3d7ff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* The animated spinner */
.uic-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(52, 152, 219, 0.3); /* Light part of the circle */
    border-top-color: #3498db; /* Dark part of the circle */
    border-radius: 50%;
    animation: uic-spin 1s linear infinite;
    flex-shrink: 0; /* Prevent the spinner from shrinking */
}

@keyframes uic-spin {
    to {
        transform: rotate(360deg);
    }
}

/* The text container */
.uic-notice-text {
    flex-grow: 1; /* Allow the text to take up the available space */
    color: #31708f;
    font-size: 14px;
}

.uic-notice-text strong {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

/* The stop button */
.uic-stop-button {
    background-color: #e74c3c; /* Red color for stop/cancel */
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.uic-stop-button:hover {
    background-color: #c0392b; /* Darker red on hover */
    transform: scale(1.05);
}

/* --- Styles for XLSX Mapping Screen --- */
.uic-mapping-select option.option-disabled {
    color: #999; /* Lighter gray text */
    background-color: #f0f0f0; /* A slightly darker background */
    font-style: italic;
}