/**
 * Portal Styles — Salla Odoo Portal (CustomerPortal)
 */

/* ── Reset & Base ────────────────────────────────────────────────────────── */
.sop-portal *,
.sop-portal *::before,
.sop-portal *::after {
	box-sizing: border-box;
}

.sop-portal {
	direction: rtl;
	font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
	font-size: 15px;
	color: #1e293b;
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px 16px;
}

/* ── Portal Notice (login required / no customer) ────────────────────────── */
.sop-portal-notice {
	padding: 18px 22px;
	border-radius: 10px;
	font-size: 15px;
	margin-bottom: 20px;
}
.sop-portal-notice.sop-notice-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.sop-portal-notice.sop-notice-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.sop-portal-notice.sop-notice-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.sop-portal-notice p { margin: 0; }
.sop-portal-notice a { color: inherit; font-weight: 600; }

/* ── Navigation Tabs ─────────────────────────────────────────────────────── */
.sop-nav {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid #e2e8f0;
	margin-bottom: 28px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.sop-nav-btn {
	padding: 12px 20px;
	border: none;
	background: transparent;
	font-size: 14px;
	font-weight: 500;
	color: #64748b;
	cursor: pointer;
	white-space: nowrap;
	position: relative;
	transition: color 0.2s;
	border-radius: 6px 6px 0 0;
}

.sop-nav-btn:hover { color: #1e293b; background: #f8fafc; }

.sop-nav-btn.active {
	color: #2563eb;
	font-weight: 600;
}

.sop-nav-btn.active::after {
	content: '';
	position: absolute;
	bottom: -2px;
	right: 0;
	left: 0;
	height: 2px;
	background: #2563eb;
	border-radius: 2px 2px 0 0;
}

/* ── Tabs Content ────────────────────────────────────────────────────────── */
.sop-tab-content { min-height: 200px; }

.sop-tab { display: none; }
.sop-tab.active { display: block; }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.sop-dashboard { padding: 4px 0; }

.sop-welcome {
	background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
	color: #fff;
	border-radius: 12px;
	padding: 24px 28px;
	margin-bottom: 24px;
}
.sop-welcome h2 { margin: 0 0 6px; font-size: 22px; }
.sop-welcome p  { margin: 0; opacity: .85; font-size: 14px; }

.sop-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 16px;
	margin-bottom: 28px;
}

.sop-stat-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 20px;
	text-align: center;
	box-shadow: 0 1px 4px rgba(0,0,0,.05);
	transition: box-shadow .2s, transform .2s;
}
.sop-stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-2px); }

.sop-stat-number { display: block; font-size: 38px; font-weight: 700; line-height: 1.1; margin-bottom: 6px; }
.sop-stat-label  { font-size: 13px; color: #64748b; }

.sop-stat-card               .sop-stat-number { color: #2563eb; }
.sop-stat-card.sop-card-green .sop-stat-number { color: #16a34a; }
.sop-stat-card.sop-card-blue  .sop-stat-number { color: #0891b2; }
.sop-stat-card.sop-card-orange .sop-stat-number{ color: #ea580c; }

.sop-onboarding {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 10px;
	padding: 20px 24px;
	margin-bottom: 20px;
}
.sop-onboarding h3 { margin: 0 0 10px; color: #15803d; }
.sop-onboarding ol { margin: 8px 0 0 20px; color: #374151; }
.sop-onboarding li { margin-bottom: 6px; line-height: 1.6; }

.sop-activity-list {
	list-style: none;
	padding: 0;
	margin: 0;
}
.sop-activity-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid #f1f5f9;
	font-size: 13px;
	color: #475569;
}
.sop-activity-list li:last-child { border-bottom: none; }
.sop-activity-list small { margin-right: auto; color: #94a3b8; font-size: 12px; }

/* ── Section Header ──────────────────────────────────────────────────────── */
.sop-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	gap: 12px;
}
.sop-section-header h2,
.sop-section-header h3 { margin: 0; font-size: 20px; color: #0f172a; }

/* ── Tabs generic h2/h3 ──────────────────────────────────────────────────── */
.sop-stores-tab > h2,
.sop-odoo-tab > h2,
.sop-logs-tab > h2 {
	font-size: 20px;
	color: #0f172a;
	margin-bottom: 18px;
}

/* ── Form Panel (Add/Edit store) ─────────────────────────────────────────── */
.sop-form-panel {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 24px;
	margin-bottom: 20px;
}
.sop-form-panel h3 { margin: 0 0 18px; font-size: 17px; color: #0f172a; }

/* ── Form Rows ───────────────────────────────────────────────────────────── */
.sop-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

.sop-form-row {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.sop-form-row label {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
}

.sop-input,
.sop-form-row input,
.sop-form-row select,
.sop-form-row textarea {
	padding: 9px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	color: #1e293b;
	background: #fff;
	transition: border-color .2s, box-shadow .2s;
	width: 100%;
}

.sop-input:focus,
.sop-form-row input:focus,
.sop-form-row select:focus,
.sop-form-row textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.sop-hint {
	font-size: 12px;
	color: #94a3b8;
	margin-top: 2px;
}

/* ── Password Toggle ─────────────────────────────────────────────────────── */
.sop-password-wrap {
	position: relative;
	display: flex;
	align-items: center;
}
.sop-password-wrap .sop-input { padding-left: 38px; flex: 1; }
.sop-toggle-password {
	position: absolute;
	left: 10px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	font-size: 16px;
	color: #94a3b8;
	line-height: 1;
}
.sop-toggle-password:hover { color: #475569; }

/* ── Form Actions ────────────────────────────────────────────────────────── */
.sop-form-actions {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-top: 16px;
	flex-wrap: wrap;
}

/* ── Form Notice (test/save/n8n status) ──────────────────────────────────── */
.sop-form-notice {
	border-radius: 8px;
	padding: 10px 14px;
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.5;
}
.sop-notice-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.sop-notice-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.sop-notice-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.sop-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 18px;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: background .2s, transform .1s, opacity .2s;
	font-family: inherit;
	text-decoration: none;
}
.sop-btn:active { transform: scale(.97); }
.sop-btn:disabled { opacity: .5; cursor: not-allowed; }

.sop-btn-primary   { background: #2563eb; color: #fff; }
.sop-btn-primary:hover { background: #1d4ed8; }

.sop-btn-secondary { background: #e2e8f0; color: #374151; }
.sop-btn-secondary:hover { background: #cbd5e1; }

.sop-btn-warning   { background: #f59e0b; color: #fff; }
.sop-btn-warning:hover { background: #d97706; }

.sop-btn-danger    { background: #ef4444; color: #fff; }
.sop-btn-danger:hover { background: #dc2626; }

.sop-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.sop-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.sop-table thead { background: #f8fafc; }

.sop-table th {
	padding: 12px 16px;
	text-align: right;
	font-size: 12px;
	font-weight: 700;
	color: #475569;
	text-transform: uppercase;
	letter-spacing: .04em;
	border-bottom: 1px solid #e2e8f0;
	white-space: nowrap;
}

.sop-table td {
	padding: 12px 16px;
	border-bottom: 1px solid #f1f5f9;
	color: #334155;
	vertical-align: middle;
}

.sop-table tbody tr:last-child td { border-bottom: none; }
.sop-table tbody tr:hover { background: #f8fafc; }

.sop-table code {
	background: #f1f5f9;
	padding: 2px 7px;
	border-radius: 4px;
	font-size: 12px;
	font-family: 'Courier New', monospace;
	color: #0f172a;
}

.sop-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.sop-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	background: #e2e8f0;
	color: #475569;
}
.sop-badge-active   { background: #dcfce7; color: #15803d; }
.sop-badge-inactive { background: #f1f5f9; color: #64748b; }
.sop-badge-pending  { background: #fef9c3; color: #854d0e; }
.sop-badge-deleted  { background: #fee2e2; color: #991b1b; }
.sop-badge-info     { background: #dbeafe; color: #1d4ed8; }
.sop-badge-warning  { background: #fef3c7; color: #92400e; }
.sop-badge-error    { background: #fee2e2; color: #991b1b; }

/* ── Odoo Cards (one per store) ──────────────────────────────────────────── */
.sop-odoo-tab { padding: 4px 0; }

.sop-odoo-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	margin-bottom: 24px;
	box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.sop-odoo-card-header {
	background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
	color: #fff;
	padding: 16px 22px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.sop-odoo-card-header h3 { margin: 0; font-size: 17px; font-weight: 600; }

.sop-odoo-form { padding: 22px; }

/* ── Logs Tab ────────────────────────────────────────────────────────────── */
.sop-logs-tab { padding: 4px 0; }

.sop-level-filter {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.sop-filter-btn {
	padding: 5px 14px;
	border-radius: 999px;
	border: 1px solid #e2e8f0;
	background: #fff;
	font-size: 13px;
	cursor: pointer;
	color: #475569;
	transition: all .2s;
	font-family: inherit;
}
.sop-filter-btn:hover { background: #f1f5f9; }
.sop-filter-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }

.sop-logs-table .sop-log-date { white-space: nowrap; color: #94a3b8; font-size: 12px; }

.sop-log-details {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 10px;
	font-size: 12px;
	margin-top: 6px;
	white-space: pre-wrap;
	word-break: break-all;
	max-height: 200px;
	overflow-y: auto;
}

.sop-expand-btn {
	background: #e2e8f0;
	border: none;
	border-radius: 4px;
	padding: 1px 7px;
	font-size: 14px;
	cursor: pointer;
	color: #475569;
	margin-right: 6px;
	transition: background .2s;
}
.sop-expand-btn:hover { background: #cbd5e1; }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.sop-empty-state {
	text-align: center;
	padding: 48px 24px;
	color: #94a3b8;
	background: #f8fafc;
	border-radius: 12px;
	border: 1px dashed #e2e8f0;
}
.sop-empty-state p { margin: 0; font-size: 15px; }

/* ── Notices (general) ───────────────────────────────────────────────────── */
.sop-notice {
	padding: 14px 18px;
	border-radius: 8px;
	font-size: 14px;
	margin-bottom: 16px;
}
.sop-notice--info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.sop-notice--warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.sop-notice--error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.sop-notice--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.sop-stats-grid { grid-template-columns: 1fr 1fr; }
	.sop-form-grid  { grid-template-columns: 1fr; }

	.sop-table { font-size: 13px; }
	.sop-table th,
	.sop-table td { padding: 10px 12px; }

	.sop-section-header { flex-direction: column; align-items: flex-start; }
	.sop-nav-btn { padding: 10px 14px; font-size: 13px; }
}

@media (max-width: 480px) {
	.sop-stats-grid { grid-template-columns: 1fr; }
	.sop-portal { padding: 16px 10px; }
}
