/* ========================================
   Offline Orders Plugin - v1.2.0
   ======================================== */

/* Reset & Base */
.oo-wrap {
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
    max-width: 960px;
    margin: 20px auto;
    padding: 0 16px;
    color: #1a1a1a;
}

/* Frontend shortcode: inherit font from theme */
.oo-wrap.oo-front {
    font-family: inherit;
}

.oo-wrap.oo-front *,
.oo-wrap.oo-front input,
.oo-wrap.oo-front textarea,
.oo-wrap.oo-front button,
.oo-wrap.oo-front select {
    font-family: inherit;
}

.oo-wrap *,
.oo-wrap *::before,
.oo-wrap *::after {
    box-sizing: border-box;
}

/* Header */
.oo-header {
    margin-bottom: 24px;
    padding: 0 4px;
}

.oo-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    margin: 0 0 6px 0;
    padding: 0;
}

.oo-subtitle {
    font-size: 14px;
    color: #777;
    margin: 0;
}

/* ==================== Mode Selector ==================== */
.oo-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.oo-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

.oo-mode-btn:hover {
    border-color: #bbb;
    background: #fafafa;
}

.oo-mode-btn.active {
    border-color: #333;
    background: #f5f5f5;
    box-shadow: 0 0 0 1px #333;
}

.oo-mode-icon {
    font-size: 28px;
    line-height: 1;
}

.oo-mode-label {
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.oo-mode-desc {
    font-size: 12px;
    color: #888;
}

/* Card */
.oo-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.oo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
    flex-wrap: wrap;
}

.oo-card-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 0;
}

.oo-card-body {
    padding: 20px;
}

.oo-card-body.oo-no-padding {
    padding: 0;
}

/* Form Elements */
.oo-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.oo-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.oo-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.oo-form-group input[type="text"],
.oo-form-group input[type="number"],
.oo-wrap textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s, background-color 0.2s;
    font-family: inherit;
}

.oo-form-group input:focus,
.oo-wrap textarea:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.oo-wrap textarea {
    resize: vertical;
    min-height: 80px;
}

/* Search Box */
.oo-search-box {
    position: relative;
    min-width: 220px;
}

.oo-search-box input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    background: #fafafa;
    transition: border-color 0.2s;
    font-family: inherit;
}

.oo-search-box input:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.oo-search-box svg {
    position: absolute;
    left: auto;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
}

/* Table */
.oo-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.oo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.oo-table thead {
    background: #f8f8f8;
}

.oo-table th {
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
}

.oo-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
}

.oo-table tbody tr:last-child td {
    border-bottom: none;
}

.oo-table tbody tr:hover {
    background: #fafafa;
}

.oo-product-row.oo-selected {
    background: #f7faf7;
}

.oo-product-row.oo-selected:hover {
    background: #f0f7f0;
}

.oo-th-check { width: 50px; text-align: center !important; }
.oo-th-qty { width: 140px; }
.oo-th-price,
.oo-th-total { width: 130px; }
.oo-td-check { text-align: center; }
.oo-td-price,
.oo-td-total { font-family: 'Segoe UI', Tahoma, sans-serif; direction: ltr; text-align: right; }

.oo-empty {
    text-align: center;
    padding: 40px 16px !important;
    color: #aaa;
    font-size: 14px;
}

/* Variation Badge */
.oo-variation-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: #eef2ff;
    color: #4f46e5;
    margin-right: 6px;
    vertical-align: middle;
}

/* Custom Checkbox */
.oo-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    width: 20px;
    height: 20px;
}

.oo-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.oo-checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 5px;
    transition: all 0.2s;
    position: relative;
    background: #fff;
}

.oo-checkbox input:checked + .oo-checkmark {
    background: #333;
    border-color: #333;
}

.oo-checkbox input:checked + .oo-checkmark::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    left: 3px;
    bottom: 3px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin: auto;
}

/* Quantity Control */
.oo-qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.oo-qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}

.oo-qty-btn:hover:not(:disabled) {
    background: #eee;
}

.oo-qty-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.oo-qty-input {
    width: 48px;
    height: 32px;
    border: none;
    border-right: 1px solid #eee;
    border-left: 1px solid #eee;
    text-align: center;
    font-size: 13px;
    background: #fff;
    -moz-appearance: textfield;
    padding: 0;
    font-family: inherit;
}

.oo-qty-input::-webkit-outer-spin-button,
.oo-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.oo-qty-input:disabled {
    background: #f5f5f5;
    color: #bbb;
}

.oo-row-total {
    font-weight: 500;
    color: #444;
    font-size: 13px;
}

/* Source Selection */
.oo-source-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.oo-source-option {
    cursor: pointer;
}

.oo-source-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.oo-source-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    transition: all 0.2s;
    background: #fafafa;
}

.oo-source-option input:checked + .oo-source-box {
    border-color: #333;
    background: #f5f5f5;
}

.oo-source-box:hover {
    border-color: #bbb;
}

.oo-source-icon {
    font-size: 24px;
    line-height: 1;
}

.oo-source-name {
    font-size: 13px;
    font-weight: 500;
    color: #444;
}

/* Rate Field */
.oo-rate-field {
    max-width: 300px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.oo-rate-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oo-rate-input-wrap input {
    width: 100px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    background: #fafafa;
    font-family: inherit;
    direction: ltr;
}

.oo-rate-input-wrap input:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.oo-rate-suffix {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

.oo-rate-desc {
    font-size: 12px;
    color: #999;
    margin: 4px 0 0;
}

/* ==================== Bulk Mode ==================== */
.oo-bulk-row td {
    vertical-align: middle;
}

.oo-bulk-index {
    text-align: center;
    font-weight: 600;
    color: #888;
    width: 50px;
}

.oo-bulk-row input[type="text"],
.oo-bulk-row input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    background: #fafafa;
    font-family: inherit;
    transition: border-color 0.2s;
}

.oo-bulk-row input:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.oo-btn-add-bulk {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.oo-btn-add-bulk:hover {
    background: #e5e5e5;
    border-color: #bbb;
}

/* Bulk Summary */
.oo-bulk-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #555;
}

.oo-bulk-summary-item + .oo-bulk-summary-item {
    border-top: 1px solid #f0f0f0;
}

.oo-bulk-summary-item strong {
    color: #222;
}

/* Summary */
.oo-final-summary {
    margin-bottom: 20px;
}

.oo-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #555;
}

.oo-summary-row + .oo-summary-row {
    border-top: 1px solid #f0f0f0;
}

.oo-total-row {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    padding: 12px 0 4px;
    border-top: 2px solid #eee !important;
}

.oo-adjustment-row span:last-child {
    color: #c0392b;
}

/* Submit Button */
.oo-submit-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    background: #222;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    font-family: inherit;
}

.oo-submit-btn:hover:not(:disabled) {
    background: #444;
}

.oo-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.oo-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.oo-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: oo-spin 0.6s linear infinite;
}

@keyframes oo-spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.oo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.oo-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.oo-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: oo-modal-in 0.3s ease;
}

@keyframes oo-modal-in {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.oo-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-weight: 700;
}

.oo-modal-content h3 {
    font-size: 18px;
    margin: 0 0 12px;
    color: #222;
}

.oo-modal-content p {
    font-size: 14px;
    color: #666;
    margin: 4px 0;
}

.oo-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.oo-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
    font-family: inherit;
}

.oo-btn-primary {
    background: #222;
    color: #fff;
}

.oo-btn-primary:hover {
    background: #444;
    color: #fff;
}

.oo-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.oo-btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Remove button */
.oo-remove-btn {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
}

.oo-remove-btn:hover {
    background: #fde8e8;
}

/* Badges */
.oo-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.oo-badge-snap { background: #e3f2fd; color: #1565c0; }
.oo-badge-zoodex { background: #f3e5f5; color: #7b1fa2; }
.oo-badge-hozouri { background: #e8f5e9; color: #2e7d32; }
.oo-badge-omde { background: #fff3e0; color: #e65100; }

.oo-badge-mode-count { background: #e3f2fd; color: #1565c0; }
.oo-badge-mode-bulk { background: #fce4ec; color: #c62828; }

.oo-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #f0f0f0;
    color: #555;
}

.oo-action-link {
    font-size: 13px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.oo-action-link:hover {
    text-decoration: underline;
}

/* Pagination */
.oo-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.oo-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}

.oo-page-link:hover {
    border-color: #999;
    color: #111;
}

.oo-page-link.active {
    background: #222;
    border-color: #222;
    color: #fff;
}

/* Responsive */
@media (max-width: 640px) {
    .oo-wrap {
        padding: 0 10px;
    }

    .oo-form-row {
        grid-template-columns: 1fr;
    }

    .oo-source-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .oo-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .oo-search-box {
        width: 100%;
        min-width: unset;
    }

    .oo-table {
        font-size: 12px;
    }

    .oo-table th,
    .oo-table td {
        padding: 8px 10px;
    }

    .oo-modal-content {
        padding: 28px 20px;
    }

    .oo-modal-actions {
        flex-direction: column;
    }

    .oo-mode-selector {
        gap: 8px;
    }

    .oo-mode-btn {
        padding: 14px 12px;
    }
}

/* Summary Table */
.oo-summary-table td {
    font-size: 13px;
}

/* Hide in no-product state */
.oo-product-row.oo-hidden {
    display: none;
}