/* ==========================================================================
   Raignify – Frontend stylesheet
   Scope: all elements use the .rg- prefix to avoid theme conflicts.
   ========================================================================== */

/* ── Reset / base ──────────────────────────────────────────────────────────── */
.rg-card,
.rg-dashboard {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	color: #1a1a2e;
	line-height: 1.6;
}

*, *::before, *::after { box-sizing: inherit; }

/* ── Auth card (login / signup) ────────────────────────────────────────────── */
.rg-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 40px;
	margin: 40px auto;
	box-shadow: 0 4px 24px rgba(0,0,0,.06);
}

.rg-card--narrow { max-width: 440px; }

.rg-card__header { margin-bottom: 28px; text-align: center; }

.rg-card__title {
	font-size: 1.6rem;
	font-weight: 700;
	margin: 0 0 6px;
	color: #111827;
}

.rg-card__subtitle {
	margin: 0;
	color: #6b7280;
	font-size: .93rem;
}

.rg-card__footer-text {
	margin-top: 24px;
	text-align: center;
	color: #6b7280;
	font-size: .9rem;
}

/* ── Form elements ─────────────────────────────────────────────────────────── */
.rg-form { width: 100%; }

.rg-field {
	margin-bottom: 18px;
}

.rg-field--inline {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.rg-label {
	display: block;
	font-size: .85rem;
	font-weight: 600;
	color: #374151;
	margin-bottom: 6px;
	letter-spacing: .01em;
}

.rg-input {
	display: block;
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: .95rem;
	color: #111827;
	background: #fafafa;
	transition: border-color .15s, box-shadow .15s;
	outline: none;
}

.rg-input:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37,99,235,.15);
	background: #fff;
}

.rg-input--textarea { resize: vertical; min-height: 120px; }

.rg-input--color {
	width: 56px;
	height: 40px;
	padding: 4px;
	cursor: pointer;
}

.rg-input--code {
	font-family: "SF Mono", "Fira Code", monospace;
	font-size: .82rem;
	background: #f3f4f6;
	color: #1f2937;
	width: 100%;
}

.rg-checkbox-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: .88rem;
	cursor: pointer;
	color: #374151;
}

.rg-field__hint {
	margin: 4px 0 0;
	font-size: .78rem;
	color: #9ca3af;
}

.rg-form__legal {
	text-align: center;
	font-size: .78rem;
	color: #9ca3af;
	margin-top: 12px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.rg-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 11px 20px;
	border-radius: 8px;
	font-size: .92rem;
	font-weight: 600;
	border: none;
	cursor: pointer;
	transition: background .15s, box-shadow .15s, opacity .15s;
	text-decoration: none;
}

.rg-btn--primary {
	background: #2563eb;
	color: #fff;
}
.rg-btn--primary:hover { background: #1d4ed8; box-shadow: 0 2px 8px rgba(37,99,235,.35); }

.rg-btn--secondary {
	background: #f3f4f6;
	color: #374151;
	border: 1px solid #d1d5db;
}
.rg-btn--secondary:hover { background: #e5e7eb; }

.rg-btn--danger-link {
	background: none;
	border: none;
	color: #dc2626;
	padding: 4px 0;
	font-size: .88rem;
	cursor: pointer;
	font-weight: 500;
}
.rg-btn--danger-link:hover { text-decoration: underline; }

.rg-btn--full { width: 100%; justify-content: center; }

.rg-btn__arrow { font-size: 1.1em; }

/* ── Link ──────────────────────────────────────────────────────────────────── */
.rg-link { color: #2563eb; text-decoration: none; font-weight: 500; }
.rg-link:hover { text-decoration: underline; }

/* ── Notices ───────────────────────────────────────────────────────────────── */
.rg-notice {
	padding: 12px 16px;
	border-radius: 8px;
	margin-bottom: 20px;
	font-size: .92rem;
}
.rg-notice p { margin: 0; }

.rg-notice--error   { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.rg-notice--success { background: #f0fdf4; color: #166534; border-left: 4px solid #22c55e; }
.rg-notice--warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }

/* ── Plan picker (signup) ──────────────────────────────────────────────────── */
.rg-plan-picker { display: flex; gap: 12px; }

.rg-plan-option { flex: 1; cursor: pointer; }
.rg-plan-option input { position: absolute; opacity: 0; width: 0; height: 0; }

.rg-plan-option__box {
	display: block;
	border: 2px solid #d1d5db;
	border-radius: 10px;
	padding: 16px;
	text-align: center;
	transition: border-color .15s, background .15s;
}

.rg-plan-option input:checked + .rg-plan-option__box {
	border-color: #2563eb;
	background: #eff6ff;
}

/* ── Dashboard shell ───────────────────────────────────────────────────────── */
.rg-dashboard {
	max-width: 900px;
	margin: 0 auto;
	padding: 0 16px 60px;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.rg-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 0;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 24px;
}

.rg-topbar__logo {
	font-size: 1.15rem;
	font-weight: 700;
	color: #2563eb;
	letter-spacing: -.02em;
}

.rg-topbar__nav { display: flex; align-items: center; gap: 16px; }

.rg-topbar__user { font-size: .88rem; color: #6b7280; }

.rg-topbar__logout { font-size: .88rem; }

/* ── Tab navigation ────────────────────────────────────────────────────────── */
.rg-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid #e5e7eb;
	margin-bottom: 28px;
}

.rg-tab {
	padding: 10px 18px;
	font-size: .9rem;
	font-weight: 600;
	color: #6b7280;
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	border-radius: 6px 6px 0 0;
	transition: color .15s, border-color .15s;
}
.rg-tab:hover { color: #2563eb; }
.rg-tab--active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── Panel ─────────────────────────────────────────────────────────────────── */
.rg-panel { /* intentionally minimal — uses card children */ }

.rg-section-title {
	font-size: 1rem;
	font-weight: 700;
	color: #111827;
	margin: 28px 0 14px;
	padding-top: 20px;
	border-top: 1px solid #f3f4f6;
}
.rg-panel > .rg-section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ── Sub-tabs (inside Documents panel) ─────────────────────────────────────── */
.rg-sub-tabs { display: flex; gap: 4px; margin-bottom: 20px; }

.rg-sub-tab {
	padding: 8px 16px;
	font-size: .88rem;
	font-weight: 600;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #f9fafb;
	color: #374151;
	cursor: pointer;
	transition: background .12s, border-color .12s, color .12s;
}
.rg-sub-tab:hover { background: #e5e7eb; }
.rg-sub-tab--active { background: #2563eb; color: #fff; border-color: #2563eb; }

.rg-sub-panel { margin-bottom: 20px; }

/* ── Inline form (file / URL) ──────────────────────────────────────────────── */
.rg-form--inline { display: flex; align-items: flex-end; gap: 12px; }
.rg-form--inline .rg-field { flex: 1; margin-bottom: 0; }

/* ── Document table ────────────────────────────────────────────────────────── */
.rg-table-wrap { overflow-x: auto; }

.rg-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .9rem;
}

.rg-table th,
.rg-table td {
	text-align: left;
	padding: 10px 14px;
	border-bottom: 1px solid #f3f4f6;
}

.rg-table th {
	font-weight: 600;
	color: #6b7280;
	font-size: .8rem;
	text-transform: uppercase;
	letter-spacing: .05em;
	background: #f9fafb;
}

.rg-table tr:last-child td { border-bottom: none; }
.rg-table tr:hover td { background: #f9fafb; }

/* Status badges */
.rg-status {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 99px;
	font-size: .78rem;
	font-weight: 600;
}
.rg-status--queued,
.rg-status--pending  { background: #fef3c7; color: #92400e; }
.rg-status--processing { background: #dbeafe; color: #1e40af; }
.rg-status--complete,
.rg-status--success  { background: #dcfce7; color: #166534; }
.rg-status--failed,
.rg-status--error    { background: #fee2e2; color: #991b1b; }

.rg-status__error { display: block; font-size: .78rem; color: #dc2626; margin-top: 2px; }

.rg-empty-state { color: #9ca3af; font-style: italic; padding: 20px 0; }

/* ── Embed wrap ────────────────────────────────────────────────────────────── */
.rg-embed-wrap { position: relative; margin-top: 12px; }
.rg-embed-wrap .rg-copy-btn { margin-top: 10px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.rg-card { padding: 28px 20px; }
	.rg-form--inline { flex-direction: column; align-items: stretch; }
	.rg-plan-picker { flex-direction: column; }
	.rg-field--inline { flex-direction: column; align-items: flex-start; }
	.rg-tabs { overflow-x: auto; }
}
