/* BB Stock Manager — Styles */

:root {
    --bb-primary: #2271b1;
    --bb-primary-hover: #135e96;
    --bb-danger: #b32d2e;
    --bb-danger-hover: #a00;
    --bb-success: #00a32a;
    --bb-warning: #996800;
    --bb-bg: #f0f0f1;
    --bb-card-bg: #fff;
    --bb-text: #1d2327;
    --bb-text-muted: #646970;
    --bb-border: #c3c4c7;
    --bb-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --bb-radius: 8px;
}

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

.bb-stock-manager-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bb-bg);
    color: var(--bb-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Login Form */
.bb-stock-login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.bb-stock-login-card {
    background: var(--bb-card-bg);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.bb-stock-login-card h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.bb-stock-login-subtitle {
    color: var(--bb-text-muted);
    text-align: center;
    margin-bottom: 24px;
}

.bb-stock-form-group {
    margin-bottom: 16px;
}

.bb-stock-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.bb-stock-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bb-border);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.bb-stock-form-group input:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 1px var(--bb-primary);
}

/* Buttons */
.bb-stock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.bb-stock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bb-stock-btn-primary {
    background: var(--bb-primary);
    color: #fff;
    border-color: var(--bb-primary);
}

.bb-stock-btn-primary:hover:not(:disabled) {
    background: var(--bb-primary-hover);
    border-color: var(--bb-primary-hover);
}

.bb-stock-btn-danger {
    background: var(--bb-danger);
    color: #fff;
    border-color: var(--bb-danger);
}

.bb-stock-btn-danger:hover:not(:disabled) {
    background: var(--bb-danger-hover);
    border-color: var(--bb-danger-hover);
}

.bb-stock-btn-outline {
    background: transparent;
    color: var(--bb-text);
    border-color: var(--bb-border);
}

.bb-stock-btn-outline:hover:not(:disabled) {
    background: var(--bb-bg);
}

.bb-stock-btn-full {
    width: 100%;
}

.bb-stock-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.bb-stock-btn-logout {
    background: transparent;
    color: var(--bb-text-muted);
    border-color: var(--bb-border);
    font-size: 13px;
}

.bb-stock-btn-logout:hover {
    color: var(--bb-danger);
    border-color: var(--bb-danger);
}

/* Alert */
.bb-stock-alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.bb-stock-alert-error {
    background: #fcf0f1;
    color: var(--bb-danger);
    border: 1px solid #f5c6cb;
}

.bb-stock-alert-warning {
    background: #fff8e1;
    color: #7a5c00;
    border: 1px solid #ffd54f;
}

.bb-stock-alert-success {
    background: #e8f5e9;
    color: var(--bb-success);
    border: 1px solid #c3e6cb;
}

/* Container */
.bb-stock-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.bb-stock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bb-border);
}

.bb-stock-header h1 {
    font-size: 22px;
    font-weight: 600;
}

/* Toolbar */
.bb-stock-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.bb-stock-search {
    flex: 1;
    min-width: 200px;
}

.bb-stock-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bb-border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bb-card-bg);
}

.bb-stock-search input:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 1px var(--bb-primary);
}

.bb-stock-filter select {
    padding: 10px 12px;
    border: 1px solid var(--bb-border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--bb-card-bg);
    cursor: pointer;
}

.bb-stock-stats {
    font-size: 13px;
    color: var(--bb-text-muted);
    white-space: nowrap;
}

/* Products List */
.bb-stock-products {
    background: var(--bb-card-bg);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    overflow: hidden;
}

.bb-stock-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--bb-text-muted);
}

.bb-stock-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bb-border);
    border-top-color: var(--bb-primary);
    border-radius: 50%;
    animation: bb-stock-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.bb-stock-empty {
    text-align: center;
    padding: 40px;
    color: var(--bb-text-muted);
}

/* Product Item */
.bb-stock-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f1;
    transition: background 0.15s;
}

.bb-stock-product:last-child {
    border-bottom: none;
}

.bb-stock-product:hover {
    background: #f9f9f9;
}

.bb-stock-product-image {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bb-bg);
    flex-shrink: 0;
}

.bb-stock-product-image-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: var(--bb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bb-text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

.bb-stock-product-info {
    flex: 1;
    min-width: 0;
}

.bb-stock-product-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bb-stock-product-meta {
    font-size: 12px;
    color: var(--bb-text-muted);
    margin-top: 2px;
}

.bb-stock-product-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Status Badge */
.bb-stock-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.bb-stock-status-instock {
    background: #e6f4ea;
    color: #1a7f37;
}

.bb-stock-status-outofstock {
    background: #fce8e8;
    color: #b32d2e;
}

.bb-stock-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Toggle Animation */
.bb-stock-product.toggling {
    opacity: 0.6;
    pointer-events: none;
}

.bb-stock-product.toggling .bb-stock-btn {
    animation: bb-stock-pulse 1s ease infinite;
}

@keyframes bb-stock-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Pagination */
.bb-stock-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.bb-stock-page-btn {
    padding: 6px 12px;
    border: 1px solid var(--bb-border);
    border-radius: 4px;
    background: var(--bb-card-bg);
    color: var(--bb-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.bb-stock-page-btn:hover:not(:disabled) {
    background: var(--bb-bg);
    border-color: var(--bb-primary);
}

.bb-stock-page-btn.active {
    background: var(--bb-primary);
    color: #fff;
    border-color: var(--bb-primary);
}

.bb-stock-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 640px) {
    .bb-stock-container {
        padding: 12px;
    }

    .bb-stock-header h1 {
        font-size: 18px;
    }

    .bb-stock-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .bb-stock-search {
        min-width: unset;
    }

    .bb-stock-product {
        flex-wrap: wrap;
    }

    .bb-stock-product-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #f0f0f1;
    }
}
