/* ibrasoft. Form Automation System v2.0 - Clean & Modern White Theme */

:root {
  --primary: #3C20CB; /* Updated to match Logo Color */
  --primary-hover: #2b17a1;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #0f172a;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #eef2f6;
  --radius: 12px;
  --sidebar-width: 260px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: all 0.2s ease; }

/* ── Global Form Elements ── */
input[type="text"], input[type="email"], input[type="password"], 
input[type="number"], input[type="tel"], input[type="date"], input[type="url"],
select, textarea {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
  vertical-align: middle;
  margin: 4px 0;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, 
input[type="number"]:focus, input[type="tel"]:focus, input[type="date"]:focus, input[type="url"]:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(60, 32, 203, 0.15);
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Form Layout Classes ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.form-control { width: 100%; }

/* ── App Layout ── */
.app-layout { 
  display: flex; 
  min-height: 100vh;
  background: 
    radial-gradient(circle at top right, rgba(60, 32, 203, 0.4), transparent 50%),
    radial-gradient(circle at bottom left, rgba(15, 23, 42, 0.7), transparent 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%),
    url('https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&q=80&w=1920') center/fixed no-repeat;
  background-size: cover;
}
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 40px; width: calc(100% - var(--sidebar-width)); position: relative; z-index: 10; }

/* ── Sidebar (Premium Glass) ── */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  color: var(--text-main);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.sidebar-brand { padding: 32px 24px 24px; text-align: center; }
.sidebar-brand img { height: 42px; width: auto; object-fit: contain; margin: 0 auto 8px; display: block; }
.sidebar-brand-sub { 
  font-size: 0.65rem; color: var(--primary); letter-spacing: 0.1em; font-weight: 800; 
  text-transform: uppercase;
}

.sidebar-nav { padding: 12px 16px; flex: 1; overflow-y: auto; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-label { 
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted); 
  text-transform: uppercase; margin-bottom: 12px; padding-left: 12px; letter-spacing: 0.05em;
}

.sidebar-link {
  display: flex; align-items: center; padding: 10px 14px; border-radius: var(--radius);
  color: #475569; font-size: 0.9rem; font-weight: 500; margin-bottom: 4px;
}
.sidebar-link:hover { color: var(--primary); background: #f1f5f9; }
.sidebar-link.active { color: var(--primary); background: #eff6ff; font-weight: 600; }
.sidebar-link.active .dot { background: var(--primary); opacity: 1; }

.dot { 
  width: 6px; height: 6px; background: #94a3b8; border-radius: 50%; 
  margin-right: 14px; opacity: 0.4; 
}

.sidebar-footer { padding: 24px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; margin-bottom: 20px; }
.sidebar-avatar { 
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; 
  font-weight: 700; margin-right: 12px; font-size: 1rem; flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-main); }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }

.sidebar-logout { 
  display: block; text-align: center; padding: 12px; border-radius: var(--radius); 
  background: #fef2f2; color: #dc2626; font-size: 0.85rem; font-weight: 600; 
}
.sidebar-logout:hover { background: #fee2e2; }

/* ── Dashboard Cards & Stats ── */
.page-title { font-size: 2.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 8px; letter-spacing: -0.02em; }
.page-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 30px; font-weight: 500; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; margin-bottom: 30px; }
.stat-card { 
  background: rgba(255, 255, 255, 0.96); padding: 24px; border-radius: 20px; 
  border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -15px rgba(0,0,0,0.4); }
.stat-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-main); line-height: 1.2; }

.card { 
  background: rgba(255, 255, 255, 0.96); border-radius: 20px; border: 1px solid rgba(255,255,255,0.6); 
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3); margin-bottom: 24px; overflow: hidden;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.card-header { padding: 24px; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.01em; }
.card-body { padding: 24px; }

/* ── Buttons ── */
.btn { 
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; 
  border-radius: var(--radius); font-weight: 600; cursor: pointer; border: none; 
  font-size: 0.875rem; transition: all 0.2s ease; gap: 8px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: white; color: #475569; border: 1px solid #e2e8f0; }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { 
  text-align: left; padding: 12px 24px; background: #f8fafc; color: var(--text-muted); 
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
td { padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-info { background: #eff6ff; color: #3b82f6; }
.badge-success { background: #d1fae5; color: #059669; }

/* ── Grid Utilities ── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Premium Login Page ── */
.premium-login {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  /* Premium aesthetic: dark/corporate overlay on a modern architectural/professional background */
  background: 
    radial-gradient(circle at top right, rgba(60, 32, 203, 0.4), transparent 50%),
    radial-gradient(circle at bottom left, rgba(15, 23, 42, 0.7), transparent 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%),
    url('https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&q=80&w=1920') center/cover no-repeat;
  padding: 20px;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  box-shadow: 0 40px 60px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
  width: 100%;
  max-width: 440px;
  padding: 48px;
  position: relative;
  overflow: hidden;
  animation: modalFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Subtle accent line on top of the card */
.glass-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6, var(--primary));
  background-size: 200% auto;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #64748b;
  font-size: 0.95rem;
}

.custom-input-group {
  margin-bottom: 24px;
}

.custom-input-group .form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.password-label-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.password-label-wrap .form-label {
  margin-bottom: 0;
}

.forgot-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.input-icon-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.95rem;
  transition: color 0.2s;
  z-index: 10;
}

.premium-input {
  padding-left: 44px !important;
  height: 48px;
  font-size: 0.95rem;
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02) inset;
  color: var(--text-main);
}

.premium-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(60, 32, 203, 0.1), 0 2px 4px rgba(0,0,0,0.02) inset;
}

.premium-input:focus + .input-icon, 
.input-icon-wrap:focus-within .input-icon {
  color: var(--primary);
}

.premium-btn {
  height: 52px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  margin-top: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #2b17a1 100%);
  box-shadow: 0 8px 20px -6px rgba(60, 32, 203, 0.4);
  border: none;
  color: white;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.premium-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -8px rgba(60, 32, 203, 0.5);
  background: linear-gradient(135deg, #4b30ed 0%, var(--primary) 100%);
}

.premium-btn .auth-icon {
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.premium-btn:hover .auth-icon {
  transform: translateX(4px);
}

.login-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.login-footer p {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0;
}

.login-footer strong {
  color: #64748b;
}

/* Clear form block width for specific usage */
.btn-block { width: 100%; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; transition: all 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }

.modal {
  background: white; width: 100%; max-width: 500px; border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  transform: translateY(20px); transition: all 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; background: #f8fafc; border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; display: flex; justify-content: flex-end; gap: 12px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Alerts & Toasts ── */
.alert { 
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 24px; font-size: 0.9rem; font-weight: 500;
  display: flex; align-items: center; gap: 12px;
}
.alert-success { background: #ecfdf5; color: #059669; border: 1px solid #d1fae5; }
.alert-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fee2e2; }

/* ── Empty States ── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.empty-state-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 24px; max-width: 320px; margin-left: auto; margin-right: auto; }

/* ── Queue & Activity ── */
.queue-item { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 0.9rem; transition: background 0.2s; }
.queue-item:hover { background: #f8fafc; }
.queue-id { color: var(--text-muted); font-size: 0.75rem; font-family: monospace; min-width: 48px; }
.queue-client { font-weight: 600; color: var(--text-main); min-width: 140px; }
.queue-campaign { min-width: 100px; }
.queue-meta { color: var(--text-muted); font-size: 0.8rem; flex: 1; display: flex; align-items: center; gap: 12px; }
.queue-time { color: var(--text-muted); font-size: 0.8rem; min-width: 160px; text-align: right; }

/* ── Webhook Indicator ── */
.ws-badge { 
    display: flex; align-items: center; gap: 8px; font-size: 0.75rem; 
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 6px 12px; border-radius: 20px; background: #f1f5f9; color: #64748b;
}
.ws-badge.connected { background: #dcfce7; color: #166534; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.connected .ws-dot { background: #22c55e; box-shadow: 0 0 8px #22c55e; }

/* ── Field Builder ── */
.field-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.field-item { 
  display: flex; align-items: center; gap: 12px; padding: 16px; 
  background: #f8fafc; border: 1px solid var(--border); border-radius: 12px;
  transition: all 0.2s;
}
.field-item:hover { border-color: var(--primary); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05); }
.field-drag { cursor: grab; color: #94a3b8; font-size: 1.25rem; -webkit-user-select: none; user-select: none; }
.field-remove { 
  background: #fee2e2; color: #dc2626; border: none; width: 32px; height: 32px; 
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.25rem; transition: all 0.2s;
}
.field-remove:hover { background: #fecaca; }

/* ── Utility Classes ── */
.mb-3 { margin-bottom: 24px; }
.mt-4 { margin-top: 32px; }
