/* ===========================
   Pages Styles (Products & Users)
   =========================== */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 900;
    color: var(--gray-900);
    margin: 0 0 4px 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Page Error */
.page-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.page-error i {
    font-size: 80px;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.page-error h2 {
    font-size: 24px;
    color: var(--gray-700);
    margin: 0;
}

/* Filters Card */
.filters-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-item {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.product-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--gray-100);
    overflow: hidden;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 60px;
    color: var(--gray-300);
}

.stock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
}

.stock-badge.in-stock {
    background: var(--secondary-color);
}

.stock-badge.low-stock {
    background: var(--warning-color);
}

.stock-badge.out-of-stock {
    background: var(--danger-color);
}

.product-details {
    padding: 20px;
}

.product-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 4px 0;
}

.product-category {
    font-size: 13px;
    color: var(--gray-500);
    margin: 0 0 16px 0;
}

.product-info-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    flex: 1;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

.info-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
}

.product-prices {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
}

.price-item {
    flex: 1;
}

.price-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.price-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.price-value.sale-price {
    color: var(--secondary-color);
}

.product-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Users Stats Row */
.users-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 16px;
    align-items: center;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366F1 100%);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #059669 100%);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #D97706 100%);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--gray-900);
    line-height: 1;
}

/* Users Grid */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.user-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.user-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.user-card.inactive {
    opacity: 0.6;
}

.user-card-header {
    padding: 24px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.user-role-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
}

.user-card-body {
    padding: 24px;
}

.user-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 16px 0;
}

.user-info .info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-600);
}

.user-info .info-row i {
    width: 20px;
    color: var(--gray-400);
}

.user-status {
    margin-top: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge i {
    font-size: 8px;
}

.status-badge.active,
.status-badge.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.inactive,
.status-badge.status-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-badge.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Category Badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.category-badge i {
    font-size: 10px;
}

.category-badge.no-category {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
}

.user-card-footer {
    padding: 20px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--border-color);
}

.user-permissions {
    margin-bottom: 16px;
}

.user-permissions small {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.permissions-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.permission-badge {
    display: inline-block;
    padding: 4px 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
}

.permission-badge.more {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.user-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Permissions Preview Box */
.permissions-preview-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
}

.permissions-preview-box h5 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 12px 0;
}

.permissions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.permission-item {
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
}

/* Form Section */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 16px 0;
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state p {
    margin-top: 16px;
    font-size: 14px;
    color: var(--gray-500);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 80px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .products-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }
    
    .users-stats-row {
        grid-template-columns: 1fr;
    }
    
    .permissions-list {
        grid-template-columns: 1fr;
    }
}


/* =============================================
   Profile Page  |  صفحة البروفايل
   ============================================= */
.prf-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) { .prf-layout { grid-template-columns: 1fr; } }

.prf-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    margin-bottom: 16px;
    border: 1px solid #f0f0f0;
}
.prf-id-card { text-align: center; }

.prf-avatar-wrap { position: relative; display: inline-block; margin-bottom: 13px; }
.prf-avatar {
    width: 86px; height: 86px; border-radius: 50%;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; font-size: 28px; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    box-shadow: 0 5px 18px rgba(102,126,234,.35);
}
.prf-dot {
    position: absolute; bottom: 4px; right: 4px;
    width: 17px; height: 17px; border-radius: 50%; border: 2px solid #fff;
}
.prf-dot-on  { background: #10b981; }
.prf-dot-off { background: #ef4444; }

.prf-name  { font-size: 18px; font-weight: 700; color: #1f2937; margin-bottom: 7px; }
.prf-badge {
    display: inline-block;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; font-size: 12px; font-weight: 600;
    padding: 3px 14px; border-radius: 20px; margin-bottom: 13px;
}
.prf-meta { font-size: 12px; color: #6b7280; line-height: 2; }
.prf-meta div { display: flex; align-items: center; justify-content: center; gap: 6px; }
.prf-meta i   { color: #9ca3af; width: 13px; }

.prf-renew-btn {
    display: inline-flex; align-items: center; gap: 7px;
    margin-top: 15px; padding: 9px 20px;
    background: linear-gradient(135deg,#10b981,#059669);
    color: #fff; border: none; border-radius: 10px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    font-family: inherit; text-decoration: none;
    transition: opacity .2s;
}
.prf-renew-btn:hover { opacity: .85; }

.prf-col {}
.prf-card-hdr {
    display: flex; align-items: center; gap: 9px;
    font-size: 15px; font-weight: 700; color: #1f2937;
    margin-bottom: 14px; padding-bottom: 11px;
    border-bottom: 2px solid #f3f4f6;
}
.prf-card-hdr i { color: #667eea; }

.prf-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 0; border-bottom: 1px solid #f9fafb; gap: 10px;
}
.prf-row:last-child { border-bottom: none; padding-bottom: 0; }
.prf-lbl { font-size: 13px; color: #6b7280; font-weight: 500; min-width: 115px; white-space: nowrap; }
.prf-val  { font-size: 13px; color: #1f2937; font-weight: 600; text-align: left; word-break: break-all; }
.prf-mono { font-family: 'Courier New',monospace; font-size: 11px !important; color: #9ca3af !important; font-weight: 400 !important; }

.prf-role-chip { padding: 2px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.prf-role-owner       { background: #ede9fe; color: #5b21b6; }
.prf-role-manager     { background: #dbeafe; color: #1d4ed8; }
.prf-role-cashier     { background: #dcfce7; color: #166534; }
.prf-role-super_admin { background: #fef3c7; color: #92400e; }

.prf-status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.prf-active   { background: #dcfce7; color: #166534; }
.prf-inactive { background: #fee2e2; color: #991b1b; }
.prf-status-chip i { font-size: 7px; }

.prf-sec-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.prf-sec-info { display: flex; align-items: center; gap: 12px; }
.prf-sec-info > i { font-size: 22px; color: #667eea; }
.prf-sec-title { font-size: 14px; font-weight: 600; color: #1f2937; }
.prf-sec-dots  { font-size: 13px; color: #9ca3af; letter-spacing: 2px; }
.prf-change-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; border: none; border-radius: 9px;
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: opacity .2s;
}
.prf-change-btn:hover { opacity: .85; }


/* =============================================
   Subscription Renewal Page  |  تجديد الاشتراك
   ============================================= */
.subr-wrap { max-width: 740px; margin: 0 auto; }

.subr-status-card {
    text-align: center; background: #fff;
    border-radius: 14px; padding: 28px 22px; margin-bottom: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.subr-status-text { font-size: 18px; font-weight: 700; color: #1f2937; margin-bottom: 5px; }
.subr-expiry      { font-size: 13px; color: #6b7280; margin-bottom: 3px; }
.subr-store       { font-size: 12px; color: #9ca3af; }

.subr-section-title {
    font-size: 16px; font-weight: 700; color: #1f2937;
    display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.subr-section-title i { color: #667eea; }

.subr-plans {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 20px;
}
@media (max-width: 580px) { .subr-plans { grid-template-columns: 1fr; } }

.subr-plan {
    background: #fff; border-radius: 14px; padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    border: 2px solid #f0f0f0; text-align: center;
    cursor: pointer; transition: all .22s; position: relative; overflow: hidden;
}
.subr-plan:hover { border-color: #667eea; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(102,126,234,.2); }
.subr-plan-featured { border-color: #667eea; }

.subr-recommended {
    position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; font-size: 11px; font-weight: 700;
    padding: 3px 14px; border-radius: 0 0 10px 10px;
}

.subr-plan-icon { font-size: 30px; color: #667eea; margin: 10px 0 8px; }
.subr-plan h4   { font-size: 17px; font-weight: 700; color: #1f2937; margin-bottom: 10px; }

.subr-price { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin-bottom: 5px; }
.subr-price-num  { font-size: 26px; font-weight: 900; color: #1f2937; }
.subr-price-unit { font-size: 12px; color: #9ca3af; }

.subr-save {
    background: #dcfce7; color: #166534;
    font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 20px; display: inline-block; margin-bottom: 10px;
}

.subr-features { list-style: none; padding: 0; margin: 10px 0 16px; text-align: right; }
.subr-features li { font-size: 13px; color: #4b5563; padding: 2px 0; }
.subr-features i  { color: #10b981; margin-left: 6px; }

.subr-btn {
    width: 100%; padding: 10px; border: 2px solid #667eea;
    background: transparent; color: #667eea;
    border-radius: 10px; font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: all .2s;
}
.subr-btn:hover { background: #667eea; color: #fff; }
.subr-btn-primary {
    background: linear-gradient(135deg,#667eea,#764ba2) !important;
    color: #fff !important; border: none !important;
}

.subr-how {
    background: #fff; border-radius: 14px; padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.subr-steps { display: flex; flex-direction: column; gap: 11px; margin: 14px 0 20px; }
.subr-step  { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #374151; }
.subr-step-n {
    min-width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.subr-start-btn {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 12px 26px;
    background: linear-gradient(135deg,#667eea,#764ba2);
    color: #fff; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: opacity .2s;
}
.subr-start-btn:hover { opacity: .88; }
