/* style.css */
/*     --primary-color: #4a6cf7;
    --primary-hover: #3a5ce4;
    --secondary-color: #f5f7ff; */
:root {
    --primary-color: #2B3430;
    --primary-hover: #232B27;
    --secondary-color: #f5f7ff;
    --text-color: #333;
    --border-color: #e2e8f0;
    --error-color: #e53e3e;
    --success-color: #38a169;
    --gray-light: #f8fafc;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9fafb;
    padding: 30px 20px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
}

h1, h2 { color: #2d3748; margin-bottom: 20px; font-weight: 600; }
h1 { font-size: 28px; text-align: center; margin-bottom: 30px; }
h2 { font-size: 22px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-top: 30px; }
p { color: #4a5568; margin-bottom: 20px; }

.form-group { margin-bottom: 24px; }
label { display: block; margin-bottom: 8px; font-weight: 500; color: #2d3748; }

input[type="text"], input[type="email"], select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: white;
    color: #2d3748;
    font-family: inherit;
}
input[type="text"]:focus, input[type="email"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}
textarea { resize: vertical; min-height: 60px; }

button {
    padding: 12px 24px; background-color: var(--primary-color); color: white;
    border: none; border-radius: var(--radius); cursor: pointer; font-size: 16px;
    font-weight: 500; transition: background-color 0.2s, transform 0.1s;
    display: inline-flex; align-items: center; justify-content: center;
}
button:hover:enabled { background-color: var(--primary-hover); }
button:active:enabled { transform: translateY(1px); }
button:disabled { background-color: #a0aec0; cursor: not-allowed; }

#product-list { margin-top: 25px; }

.product-item {
    background-color: var(--gray-light); border-radius: var(--radius); padding: 20px;
    margin-bottom: 16px; border: 1px solid var(--border-color);
    transition: all 0.2s ease; cursor: pointer; position: relative;
    padding-left: 15px;
}
.product-item:not(.disabled-unit):hover { border-color: var(--primary-color); box-shadow: var(--shadow); }

.product-item.selected {
    border-color: var(--primary-color); background-color: var(--secondary-color);
    border-width: 2px; padding: 19px; padding-left: 14px;
}

.checkbox-wrapper { display: none; }
.custom-checkbox { display: none; }

.product-item-header { display: flex; align-items: flex-start; gap: 15px; }
.product-container { display: flex; flex: 1; gap: 15px; }
.product-image-container { width: 80px; height: 80px; border-radius: var(--radius); overflow: hidden; flex-shrink: 0; border: 1px solid var(--border-color); background-color: white; }
.product-image { width: 100%; height: 100%; object-fit: contain; }
.product-info { 
    flex: 1;
    position: relative;
    z-index: 1;
    padding-right: 85px; /* Increased space for unselect button */
    /* Removed overflow: hidden from container */
}
.product-info label { 
    font-weight: 500; 
    font-size: 16px; 
    margin-bottom: 0; 
    display: block; 
    overflow-wrap: break-word; /* Standard property for word breaking */
    word-break: break-word; /* Add for compatibility */
}
.variant-title, .sku { color: #718096; font-size: 14px; display: block; margin-top: 2px; }
.sku { font-size: 13px; color: #a0aec0; }
.quantity-hint { display: inline-block; font-size: 12px; background-color: #e2e8f0; color: #4a5568; padding: 2px 8px; border-radius: 12px; margin-top: 4px; font-weight: 500; }

.reason-select-container {
    margin-top: 15px; border-top: 1px dashed #cbd5e0; padding-top: 15px;
    display: none; /* Hide by default */
    padding-left: calc(80px + 15px); /* Image width + gap */
}
.product-item.selected .reason-select-container { display: block; }
.reason-select-container > label { font-size: 14px; margin-bottom: 5px; font-weight: 600;} /* Main reason label */
.reason-select { margin-bottom: 15px; }
.notes-label { display: block; margin-top: 10px; margin-bottom: 5px; font-size: 14px; font-weight: 600;}
.notes-textarea { font-size: 14px; padding: 10px; width: 100%; }

.error-message, .success-message { margin-top: 20px; padding: 15px; border-radius: var(--radius); border-left: 4px solid; font-weight: 500; }
.error-message { color: var(--error-color); background-color: #fff5f5; border-color: var(--error-color); }
.success-message { color: var(--success-color); background-color: #f0fff4; border-color: var(--success-color); text-align: center; padding: 30px 20px; }
#confirmation-message h2 { border: none; margin-bottom: 10px; }

.loading { display: flex; align-items: center; justify-content: center; padding: 20px; color: #718096; }
.loading::after { content: ""; width: 20px; height: 20px; border: 2px solid #cbd5e0; border-top: 2px solid var(--primary-color); border-radius: 50%; margin-left: 10px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.hidden { display: none !important; }
.form-action { margin-top: 30px; text-align: center; }

/* Styles for Disabled/Returned Items */
.product-item.disabled-unit { opacity: 0.6; background-color: #f8f9fa; cursor: not-allowed; border-color: #e9ecef; }
.product-item.disabled-unit:hover { border-color: #e9ecef; box-shadow: none; }
.disabled-text { color: #6c757d !important; }
.disabled-hint { background-color: #adb5bd !important; color: white !important; }
.product-item.disabled-unit .reason-select-container { display: none !important; }

/* Status message styling */
.status-message { font-size: 0.8rem; font-weight: 500; margin-top: 8px; padding: 4px 8px; border-radius: 4px; display: inline-block; border: 1px solid; }
.status-message.already-returned { background-color: #e9ecef; color: #495057; border-color: #ced4da; }
.status-message.non-returnable-date { background-color: #fff3cd; color: #856404; border-color: #ffeeba; }
/* New status styles */
.status-message.non-returnable-delivery { background-color: #d1ecf1; color: #0c5460; border-color: #bee5eb; } /* Light blue/info */
.status-message.non-returnable-generic { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; } /* Light red/warning */

/* Highlight item with missing reason */
.product-item.error-highlight .reason-select,
.product-item.error-highlight .sub-reason-select {
     border-color: var(--error-color) !important;
     box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2);
}

.no-returnable-products-message { background-color: #fffbeb; border-left: 4px solid #f59e0b; padding: 15px; margin: 20px 0; color: #b45309; font-weight: 500; border-radius: var(--radius); }

/* --- Styles for Sub-Reasons (ADDED) --- */
.sub-reason-container {
    margin-top: 10px;
    padding-left: 15px; /* Indent slightly more */
    border-left: 3px solid var(--border-color); /* Visual indicator */
    padding-top: 10px;
    padding-bottom: 5px; /* Space below sub-reason */
    animation: fadeIn 0.3s ease-out;
}

.sub-reason-container label {
    font-size: 13px; /* Slightly smaller label */
    font-weight: 500; /* Normal weight for sub-label */
    color: #4a5568;
}

.sub-reason-select {
    width: 100%;
    margin-top: 5px;
    padding: 8px 12px; /* Slightly smaller padding */
    font-size: 14px; /* Smaller font */
    border-radius: var(--radius); /* Match other inputs */
    border: 1px solid var(--border-color);
    background-color: white;
}
.sub-reason-select:focus {
     outline: none;
     border-color: var(--primary-color);
     box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* --- End Sub-Reason Styles --- */

/* --- Styles for Unselect Button --- */
.unselect-button {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: none;
    text-decoration: underline;
    background: white;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 2;
    transition: opacity 0.2s ease-out;
    opacity: 0;
}

.product-item.selected .unselect-button {
    opacity: 1;
}
.unselect-button:hover {
    color: #333;
}
/* --- End Unselect Button Styles --- */


@media (max-width: 600px) {
    .container { padding: 25px 15px; }
    h1 { font-size: 24px; }
    .product-item { padding: 15px; padding-left: 10px; }
    .product-item.selected { padding: 14px; padding-left: 9px; }
    .product-item-header { gap: 10px; }
    .product-image-container { width: 60px; height: 60px; }
    .reason-select-container { padding-left: 15px; }
    .sub-reason-container { padding-left: 10px; }
    .unselect-button { 
        top: 8px; 
        right: 8px; 
        font-size: 11px;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    .product-info {
        padding-right: 60px; /* Increased padding on mobile */
        /* Removed overflow: hidden from container on mobile */
    }
    /* Removed mobile-specific max-width for label */
}
