/**
 * Restock SMS Page Styles
 *
 * @package TextMe\Features
 * @since 2.0.0
 */

.textme-sms-restock-page {
    margin: 20px 20px 0 2px;
}

/* Header bar */
.textme-restock-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.textme-restock-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.textme-restock-title-group .textme-sms-title {
    margin: 0;
}

.textme-restock-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.textme-restock-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.textme-restock-status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Stats Cards */
.textme-restock-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.textme-restock-stat-card {
    flex: 1;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.textme-restock-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 6px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.textme-restock-stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Page-level Tabs */
.textme-restock-page-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 0 16px;
}

.textme-restock-page-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    transition: color 0.15s, border-color 0.15s;
}

.textme-restock-page-tab:hover {
    color: #1d2327;
}

.textme-restock-page-tab.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
    font-weight: 600;
}

.textme-restock-page-tab-count {
    display: inline-block;
    background: #e8e8e8;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.textme-restock-page-tab.active .textme-restock-page-tab-count {
    background: #e8f0fe;
    color: #1a73e8;
}

/* Toolbar */
.textme-restock-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-top: none;
    border-radius: 0;
    padding: 12px 16px;
    gap: 15px;
    flex-wrap: wrap;
}

.textme-restock-toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.textme-restock-toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.textme-restock-toolbar select,
.textme-restock-toolbar input[type="text"],
.textme-restock-toolbar input[type="number"] {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

#textme-restock-search {
    min-width: 250px;
}

/* Products List */
.textme-restock-products {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 4px 4px;
    min-height: 200px;
}

.textme-restock-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.textme-restock-loading .spinner {
    float: none;
    margin: 0 auto 10px;
}

.textme-restock-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Accordion Product Row */
.textme-restock-product {
    border-bottom: 1px solid #e9ecef;
}

.textme-restock-product:last-child {
    border-bottom: none;
}

.textme-restock-product-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
    gap: 12px;
}

.textme-restock-product-header:hover {
    background: #f8f9fa;
}

.textme-restock-product-toggle {
    font-size: 16px;
    color: #999;
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.textme-restock-product.open .textme-restock-product-toggle {
    transform: rotate(90deg);
}

.textme-restock-product-image {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e9ecef;
}

.textme-restock-product-image-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ccc;
    font-size: 18px;
}

.textme-restock-product-info {
    flex: 1;
    min-width: 0;
}

.textme-restock-product-name {
    font-weight: 600;
    color: #1d2327;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.textme-restock-product-name:hover {
    color: #0073aa;
}

.textme-restock-product-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.textme-restock-product-count {
    flex-shrink: 0;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.textme-restock-product-count.sent-only {
    background: #d4edda;
    color: #155724;
}

.textme-restock-product-show-btn {
    flex-shrink: 0;
    font-size: 12px;
}

.textme-restock-product-show-btn .textme-hide-label {
    display: none;
}

.textme-restock-product.open .textme-restock-product-show-btn .textme-show-label {
    display: none;
}

.textme-restock-product.open .textme-restock-product-show-btn .textme-hide-label {
    display: inline;
}

/* Expandable Details */
.textme-restock-product-details {
    display: none;
    padding: 0 16px 16px 48px;
    background: #fafbfc;
    border-top: 1px solid #e9ecef;
}

.textme-restock-product.open .textme-restock-product-details {
    display: block;
}

.textme-restock-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 8px;
}

.textme-restock-details-title {
    font-weight: 600;
    color: #1d2327;
    font-size: 14px;
}

.textme-restock-details-count {
    color: #666;
    font-size: 13px;
}

.textme-restock-details-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.textme-restock-send-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.textme-restock-send-btn:hover {
    background: #005a87;
}

.textme-restock-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.textme-restock-delete-btn {
    color: #dc3232;
    background: none;
    border: 1px solid #dc3232;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}

.textme-restock-delete-btn:hover {
    background: #dc3232;
    color: #fff;
}

.textme-restock-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Alerts Table */
.textme-restock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.textme-restock-table th,
.textme-restock-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.textme-restock-table th {
    background: #f1f1f1;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

.textme-restock-table tr:last-child td {
    border-bottom: none;
}

.textme-restock-table .textme-cb-col {
    width: 30px;
    text-align: center;
}

.textme-restock-phone {
    font-family: monospace;
    font-size: 13px;
}

.textme-restock-variations {
    font-size: 12px;
    color: #666;
}

.textme-restock-status-pending {
    color: #ffb900;
    font-weight: 600;
}

.textme-restock-status-sent {
    color: #46b450;
    font-weight: 600;
}

.textme-restock-status-failed {
    color: #dc3232;
    font-weight: 600;
}

.textme-restock-api-response {
    font-size: 12px;
    color: #666;
}

.textme-restock-api-response code {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
}

/* Tabs inside product details */
.textme-restock-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.textme-restock-tab {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.textme-restock-tab:hover {
    color: #1d2327;
}

.textme-restock-tab.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.textme-restock-tab-content {
    display: none;
}

.textme-restock-tab-content.active {
    display: block;
}

/* Pagination */
.textme-restock-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-top: 15px;
}

.textme-restock-pagination .textme-pagination-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.textme-restock-pagination .textme-pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.textme-restock-page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 3px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}

.textme-restock-page-btn:hover {
    background: #f0f0f0;
}

.textme-restock-page-btn.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* SMS Dialog Overlay */
.textme-restock-sms-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

.textme-restock-sms-overlay[style*="block"] {
    display: flex !important;
}

.textme-restock-sms-dialog-box {
    background: #fff;
    border-radius: 8px;
    padding: 28px 32px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.textme-restock-sms-dialog-box h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.textme-restock-sms-dialog-box label {
    display: block;
    margin-bottom: 6px;
}

.textme-restock-sms-dialog-box textarea {
    width: 100%;
    margin: 6px 0 8px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.textme-restock-sms-dialog-box textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.textme-restock-sms-dialog-box .description {
    margin: 4px 0 2px;
}

.textme-restock-sms-dialog-box .description code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.textme-restock-sms-dialog-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.textme-restock-sms-dialog-actions .spinner {
    float: none;
    margin: 0;
}

.textme-restock-char-count {
    font-size: 12px;
    color: #666;
    margin: 4px 0 0;
}

/* Responsive */
@media (max-width: 782px) {

    .textme-sms-restock-page {
        margin: 10px 0 0;
    }

    .textme-restock-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Stats – 2×2 grid instead of single row */
    .textme-restock-stats {
        flex-wrap: wrap;
        gap: 10px;
    }

    .textme-restock-stat-card {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
        padding: 14px 10px;
    }

    .textme-restock-stat-value {
        font-size: 22px;
    }

    /* Toolbar – stack vertically, full width inputs */
    .textme-restock-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .textme-restock-toolbar-left,
    .textme-restock-toolbar-right {
        flex-wrap: wrap;
        width: 100%;
    }

    #textme-restock-search {
        min-width: unset;
        width: 100%;
        flex: 1;
        box-sizing: border-box;
    }

    /* Product accordion – tighter on mobile */
    .textme-restock-product-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .textme-restock-product-name {
        font-size: 13px;
    }

    .textme-restock-product-count {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Details panel – remove deep indent */
    .textme-restock-product-details {
        padding: 0 10px 12px;
    }

    /* Details header – stack title/actions on narrow screens */
    .textme-restock-details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .textme-restock-details-actions {
        width: 100%;
    }

    .textme-restock-send-btn,
    .textme-restock-delete-btn {
        flex: 1;
        text-align: center;
    }

    /* Alerts table – horizontal scroll to prevent overlap */
    .textme-restock-tab-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .textme-restock-table {
        min-width: 550px;
        table-layout: auto;
        font-size: 12px;
    }

    .textme-restock-table th,
    .textme-restock-table td {
        white-space: nowrap;
        padding: 6px 8px;
    }

    /* Pagination */
    .textme-restock-pagination {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .textme-restock-pagination .textme-pagination-info {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    /* SMS dialog – full width on mobile */
    .textme-restock-sms-dialog-box {
        padding: 20px 16px;
        width: 95%;
    }

    .textme-restock-sms-dialog-box textarea {
        font-size: 16px; /* prevent iOS zoom */
    }
}
