/* ==========================================================================
   TIBSCON Business Management — Frontend Styles
   Premium white base with purple/pink gradients. Light + Dark mode.
   Desktop-first layout (sidebar + topbar), with a dedicated mobile layout.
   ========================================================================== */

:root {
	--tibscon-purple: #7c3aed;
	--tibscon-purple-dark: #5b21b6;
	--tibscon-pink: #ec4899;
	--tibscon-gradient: linear-gradient(135deg, var(--tibscon-purple) 0%, var(--tibscon-pink) 100%);
	--tibscon-sidebar-bg: #ffffff;
	--tibscon-topbar-bg: #ffffff;
	--tibscon-sidebar-text: #4b5563;
	--tibscon-button: var(--tibscon-pink);
	--tibscon-radius: 12px;
	--tibscon-shadow: 0 8px 30px rgba(124, 58, 237, 0.08);
}

#tibscon-app, #tibscon-app * { box-sizing: border-box; }
#tibscon-app { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

/* ---------- Light / Dark themes ---------- */
.tibscon-theme-light { --tbg: #f7f6fb; --tcard: #ffffff; --ttext: #1f2937; --tmuted: #6b7280; --tborder: #ece9f7; }
.tibscon-theme-dark  { --tbg: #14101f; --tcard: #1e1830; --ttext: #f3f0fa; --tmuted: #a89fc2; --tborder: #2c2445; }

.tibscon-wrap { background: var(--tbg); color: var(--ttext); min-height: 100vh; }

/* ---------- Auth container (login/register/otp/onboarding) ---------- */
.tibscon-auth-container {
	max-width: 460px;
	margin: 40px auto;
	background: var(--tcard);
	border-radius: 20px;
	box-shadow: var(--tibscon-shadow);
	padding: 40px 36px;
	border: 1px solid var(--tborder);
}
.tibscon-brand { font-weight: 800; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; background: var(--tibscon-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 6px; }
.tibscon-auth-container h2 { margin: 0 0 6px; font-size: 26px; }
.tibscon-sub { color: var(--tmuted); margin: 0 0 24px; font-size: 14px; }

.tibscon-form label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--ttext); }
.tibscon-form input[type=text], .tibscon-form input[type=email], .tibscon-form input[type=password], .tibscon-form select, .tibscon-form input[type=color], .tibscon-form input[type=range] {
	width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--tborder);
	background: var(--tbg); color: var(--ttext); font-size: 14px; transition: border-color .2s, box-shadow .2s;
}
.tibscon-form input:focus, .tibscon-form select:focus { outline: none; border-color: var(--tibscon-purple); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.tibscon-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tibscon-checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; font-size: 13px; }

.tibscon-pass-wrap { position: relative; }
.tibscon-toggle-pass { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--tibscon-purple); cursor: pointer; user-select: none; }

.tibscon-btn { display: inline-block; text-align: center; border: none; cursor: pointer; padding: 13px 20px; border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none; transition: transform .15s, box-shadow .15s, opacity .15s; }
.tibscon-btn-primary { background: var(--tibscon-gradient); color: #fff; width: 100%; margin-top: 22px; box-shadow: 0 6px 18px rgba(236,72,153,.3); }
.tibscon-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(236,72,153,.4); }
.tibscon-btn-ghost { background: transparent; border: 1px solid var(--tborder); color: var(--ttext); }
.tibscon-btn-small { padding: 6px 12px; font-size: 12px; background: var(--tibscon-gradient); color: #fff; }

.tibscon-form-msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.tibscon-form-msg.is-error { color: #dc2626; }
.tibscon-form-msg.is-success { color: #16a34a; }

.tibscon-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--tmuted); }
.tibscon-switch a { color: var(--tibscon-purple); font-weight: 700; text-decoration: none; }

.tibscon-otp-row { display: flex; gap: 10px; justify-content: space-between; }
.tibscon-otp-digit { width: 46px; height: 54px; text-align: center; font-size: 22px; font-weight: 700; border-radius: 10px; border: 1px solid var(--tborder); background: var(--tbg); color: var(--ttext); }
.tibscon-resend { text-align: center; margin-top: 14px; font-size: 13px; }
.tibscon-resend a { color: var(--tibscon-purple); text-decoration: none; font-weight: 600; }

/* ---------- Dashboard shell ---------- */
.tibscon-shell { display: flex; min-height: 100vh; }

.tibscon-sidebar {
	width: 250px; flex-shrink: 0; background: var(--tibscon-sidebar-bg, var(--tcard));
	border-right: 1px solid var(--tborder); padding: 26px 18px;
}
.tibscon-sidebar-brand { font-weight: 800; font-size: 15px; margin-bottom: 26px; color: var(--tibscon-sidebar-text, var(--ttext)); padding: 0 10px; }
.tibscon-sidebar-logo { max-width: 100%; max-height: 40px; display: block; }

/* ---------- Personal dashboard logo uploader (Settings > Profile) ---------- */
.tibscon-subheading { margin-top: 30px; font-size: 14px; }
.tibscon-logo-uploader { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tibscon-logo-preview { width: 60px; height: 60px; border-radius: 10px; border: 1px dashed var(--tborder); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--tbg); }
.tibscon-logo-preview img { max-width: 100%; max-height: 100%; }
.tibscon-menu { display: flex; flex-direction: column; gap: 4px; }
.tibscon-menu-item {
	padding: 12px 14px; border-radius: var(--tibscon-radius); color: var(--tibscon-sidebar-text, var(--ttext));
	text-decoration: none; font-size: 14px; font-weight: 600; opacity: .8; transition: background .15s, opacity .15s;
}
.tibscon-menu-item:hover { opacity: 1; background: rgba(124,58,237,.08); }
.tibscon-menu-item.active { opacity: 1; background: var(--tibscon-gradient); color: #fff; }

.tibscon-main { flex: 1; min-width: 0; }
.tibscon-topbar {
	display: flex; align-items: center; justify-content: space-between; padding: 18px 30px;
	background: var(--tibscon-topbar-bg, var(--tcard)); border-bottom: 1px solid var(--tborder);
}
.tibscon-topbar-title { font-size: 19px; font-weight: 800; }
.tibscon-topbar-actions { display: flex; align-items: center; gap: 14px; }
.tibscon-mode-toggle { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--tibscon-purple); padding: 8px 12px; border: 1px solid var(--tborder); border-radius: 20px; }
.tibscon-user-chip { font-size: 13px; font-weight: 600; color: var(--tmuted); }

.tibscon-content { padding: 26px 30px 60px; }

.tibscon-mobile-topbar { display: none; }

/* ---------- Cards / metrics ---------- */
.tibscon-cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tibscon-card { background: var(--tcard); border: 1px solid var(--tborder); border-radius: var(--tibscon-radius); padding: 20px; box-shadow: var(--tibscon-shadow); }
.tibscon-card-label { font-size: 12px; color: var(--tmuted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tibscon-card-value { font-size: 24px; font-weight: 800; margin-top: 8px; }
.tibscon-card-note { font-size: 12px; color: var(--tmuted); margin-top: 4px; }

/* ---------- Tables ---------- */
.tibscon-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tibscon-table { width: 100%; border-collapse: collapse; background: var(--tcard); border-radius: var(--tibscon-radius); overflow: hidden; box-shadow: var(--tibscon-shadow); }
.tibscon-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--tmuted); padding: 14px 16px; border-bottom: 1px solid var(--tborder); }
.tibscon-table td { padding: 14px 16px; border-bottom: 1px solid var(--tborder); font-size: 14px; }

/* Premium 3D-tinged table used by Billing */
.tibscon-table-premium tbody tr { transition: transform .15s, box-shadow .15s; }
.tibscon-table-premium tbody tr:hover { transform: translateY(-1px) scale(1.002); box-shadow: 0 8px 22px rgba(124,58,237,.10); position: relative; z-index: 1; }
.tibscon-status-pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tibscon-status-paid { background: rgba(22,163,74,.12); color: #16a34a; }
.tibscon-status-pending, .tibscon-status-processing { background: rgba(245,158,11,.14); color: #b45309; }
.tibscon-status-failed { background: rgba(220,38,38,.12); color: #dc2626; }

/* ---------- Billing summary: premium 3D cards ---------- */
.tibscon-billing-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 22px; }
.tibscon-billing-card-3d {
	background: var(--tcard); border: 1px solid var(--tborder); border-radius: 16px; padding: 22px;
	box-shadow: 0 14px 30px rgba(124,58,237,.12), inset 0 1px 0 rgba(255,255,255,.4);
	transform: perspective(600px) rotateX(0deg); transition: transform .2s, box-shadow .2s;
}
.tibscon-billing-card-3d:hover { transform: perspective(600px) rotateX(3deg) translateY(-3px); box-shadow: 0 20px 40px rgba(124,58,237,.2), inset 0 1px 0 rgba(255,255,255,.4); }
.tibscon-billing-card-3d .tibscon-card-value { background: var(--tibscon-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 22px; }

/* ---------- Businesses: usage pill + limit note ---------- */
.tibscon-usage-pill { display: inline-block; padding: 6px 14px; border-radius: 20px; background: rgba(124,58,237,.1); color: var(--tibscon-purple); font-weight: 700; font-size: 13px; margin-right: 10px; }
.tibscon-limit-note { background: rgba(220,38,38,.08); color: #b91c1c; border: 1px solid rgba(220,38,38,.2); border-radius: 10px; padding: 12px 16px; font-size: 13px; margin-bottom: 16px; }
#tibscon-new-business-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Plans ---------- */
.tibscon-plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 16px; }
.tibscon-plan-card { background: var(--tcard); border: 1px solid var(--tborder); border-radius: var(--tibscon-radius); padding: 24px; box-shadow: var(--tibscon-shadow); text-align: center; }
.tibscon-plan-name { font-weight: 800; font-size: 15px; }
.tibscon-duration-select { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--tborder); background: var(--tbg); color: var(--ttext); font-size: 13px; font-weight: 600; text-transform: capitalize; }
.tibscon-plan-duration-single { margin: 10px 0 0; font-size: 12px; font-weight: 700; color: var(--tmuted); text-transform: capitalize; letter-spacing: .03em; }
.tibscon-plan-price { font-size: 30px; font-weight: 800; margin: 10px 0 2px; background: var(--tibscon-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tibscon-plan-price small { font-size: 13px; color: var(--tmuted); -webkit-text-fill-color: var(--tmuted); }
.tibscon-plan-discount { font-size: 12px; font-weight: 700; color: #16a34a; min-height: 16px; margin-bottom: 8px; }
.tibscon-plan-desc { color: var(--tmuted); font-size: 13px; margin-bottom: 10px; }
.tibscon-plan-limit { font-size: 12px; color: var(--tmuted); margin-bottom: 16px; }
.tibscon-start-trial-btn { width: 100%; margin-top: 10px; }

/* ---------- Modal ---------- */
.tibscon-modal { position: fixed; inset: 0; background: rgba(20,16,31,.5); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.tibscon-modal-box { background: var(--tcard); border-radius: 16px; padding: 30px; width: 92%; max-width: 440px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.tibscon-modal-cancel { position: absolute; top: 16px; right: 20px; font-size: 13px; font-weight: 700; color: var(--tibscon-purple); cursor: pointer; }

/* ---------- Tabs (Settings) ---------- */
.tibscon-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--tborder); margin-bottom: 22px; }
.tibscon-tab { padding-bottom: 12px; font-size: 14px; font-weight: 700; color: var(--tmuted); cursor: pointer; border-bottom: 2px solid transparent; }
.tibscon-tab.active { color: var(--tibscon-purple); border-bottom-color: var(--tibscon-purple); }

.tibscon-loading { color: var(--tmuted); font-size: 14px; padding: 40px 0; text-align: center; }

/* ---------- Appearance swatches ---------- */
/* ---------- Appearance: single color box per field ---------- */
.tibscon-color-fields { display: flex; flex-wrap: wrap; gap: 26px; margin: 10px 0 20px; }
.tibscon-color-field { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tibscon-color-box {
	width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--tborder); cursor: pointer;
	display: block; position: relative; overflow: hidden; box-shadow: var(--tibscon-shadow); transition: transform .12s;
}
.tibscon-color-box:hover { transform: translateY(-2px); }
.tibscon-color-box input[type=color] { opacity: 0; width: 100%; height: 100%; cursor: pointer; border: none; padding: 0; }
.tibscon-color-field-label { font-size: 12px; font-weight: 600; color: var(--tmuted); text-align: center; max-width: 90px; }

/* ---------- Avatar dropdown ---------- */
.tibscon-avatar-wrap { position: relative; }
.tibscon-avatar-trigger { border: none; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; line-height: 0; }
.tibscon-avatar-trigger img { border-radius: 50%; display: block; border: 2px solid var(--tborder); }
.tibscon-avatar-menu {
	position: absolute; right: 0; top: calc(100% + 10px); background: var(--tcard); border: 1px solid var(--tborder);
	border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.15); min-width: 180px; padding: 10px; z-index: 500;
}
.tibscon-avatar-name { font-size: 13px; font-weight: 700; padding: 6px 10px 10px; border-bottom: 1px solid var(--tborder); margin-bottom: 6px; color: var(--ttext); }
.tibscon-avatar-menu a { display: block; padding: 9px 10px; font-size: 13px; font-weight: 600; color: var(--ttext); text-decoration: none; border-radius: 8px; }
.tibscon-avatar-menu a:hover { background: rgba(124,58,237,.08); }
.tibscon-avatar-menu a.tibscon-avatar-logout { color: #dc2626; }

/* ---------- Mobile sidebar overlay ---------- */
.tibscon-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,10,25,.45); z-index: 998; }
.tibscon-sidebar-overlay.is-visible { display: block; }

/* ==========================================================================
   RESPONSIVE — desktop keeps the full sidebar+topbar shell; mobile switches
   to a collapsible drawer sidebar with a dedicated mobile top bar.
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
	.tibscon-cards-grid { grid-template-columns: repeat(2, 1fr); }
	.tibscon-plans-grid { grid-template-columns: repeat(2, 1fr); }
	.tibscon-sidebar { width: 210px; }
}

/* Mobile */
@media (max-width: 782px) {
	.tibscon-mobile-topbar {
		display: flex; align-items: center; justify-content: space-between;
		padding: 14px 16px; background: var(--tcard); border-bottom: 1px solid var(--tborder);
	}
	.tibscon-mobile-menu-trigger { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10px; font-weight: 700; color: var(--tibscon-purple); line-height: 1; }
	.tibscon-mobile-menu-trigger .dashicons { font-size: 20px; width: 20px; height: 20px; }
	.tibscon-mobile-menu-trigger small { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; }
	.tibscon-mobile-logo { flex: 1; display: flex; justify-content: center; }
	.tibscon-mobile-logo img { max-height: 28px; max-width: 140px; display: block; }
	.tibscon-mobile-actions { display: flex; align-items: center; gap: 10px; }
	.tibscon-mobile-actions .tibscon-avatar-trigger img { width: 28px; height: 28px; }
	.tibscon-mobile-actions .tibscon-avatar-menu { right: 0; }

	.tibscon-shell { flex-direction: column; }
	.tibscon-topbar { display: none; } /* desktop topbar hidden; mobile topbar used instead */

	.tibscon-sidebar {
		position: fixed; top: 0; left: -270px; height: 100vh; width: 250px; z-index: 999;
		transition: left .25s ease; box-shadow: 10px 0 30px rgba(0,0,0,.15);
	}
	.tibscon-sidebar.is-open { left: 0; }

	.tibscon-content { padding: 18px; }
	.tibscon-cards-grid { grid-template-columns: 1fr; }
	.tibscon-billing-summary { grid-template-columns: 1fr; }
	.tibscon-plans-grid { grid-template-columns: 1fr; }
	.tibscon-color-fields { gap: 18px; }
	.tibscon-form-row { grid-template-columns: 1fr; }
	.tibscon-auth-container { margin: 20px 14px; padding: 28px 22px; }
	.tibscon-table { display: block; overflow-x: auto; white-space: nowrap; }
	.tibscon-otp-digit { width: 38px; height: 46px; font-size: 18px; }
}
