/* ============================================================
   CWT Panel — Shared Theme
   Colors matched from provided CWT template screenshots
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root{
  --orange: #ff6f5b;
  --orange-dark: #f9573f;
  --orange-light: #ff9585;
  --navy: #16233c;
  --navy-light: #1f3358;
  --gray-bg: #f3f5f9;
  --gray-text: #6c7683;
  --white: #ffffff;
  --border: #e7ebf0;
  --success: #22b573;
  --danger: #e6483b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(22,35,60,0.08);
  --shadow-lg: 0 20px 46px rgba(22,35,60,0.12);
  --grad-brand: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  --grad-navy: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

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

html{scroll-behavior:smooth;}

body{
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
  background: var(--gray-bg);
  background-image:
    radial-gradient(circle at 0% 0%, rgba(255,111,91,0.05) 0%, transparent 45%),
    radial-gradient(circle at 100% 0%, rgba(22,35,60,0.04) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--navy);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}

a{text-decoration:none; color:inherit;}
ul{list-style:none;}

/* ---------------- TOPBAR ---------------- */
.topbar{
  background:var(--white);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 30px;
  box-shadow:0 2px 16px rgba(22,35,60,0.06);
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:50;
}
.brand{
  font-weight:800;
  font-size:24px;
  letter-spacing:.5px;
  color:var(--navy);
}
.brand span{
  background:var(--grad-brand);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.topbar-right{
  display:flex;
  align-items:center;
  gap:16px;
}
.topbar-user{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:600;
  font-size:14px;
  color:var(--navy);
}
.avatar-circle{
  width:38px;height:38px;border-radius:50%;
  background:var(--grad-brand);
  box-shadow:0 4px 12px rgba(255,111,91,0.35);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:700;
  text-transform:uppercase;
}
.btn-logout{
  background:var(--grad-navy);
  color:#fff;
  padding:9px 20px;
  border-radius:30px;
  font-size:13px;
  font-weight:600;
  border:none;
  cursor:pointer;
  transition:.2s ease;
}
.btn-logout:hover{
  background:var(--grad-brand);
  box-shadow:0 6px 16px rgba(255,111,91,0.3);
  transform:translateY(-1px);
}

/* ---------------- LAYOUT ---------------- */
.layout{
  display:flex;
  min-height:calc(100vh - 74px);
}

.sidebar{
  width:252px;
  background:var(--white);
  border-right:1px solid var(--border);
  padding:26px 0;
  flex-shrink:0;
}
.sidebar-title{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--gray-text);
  padding:0 24px 12px;
  font-weight:700;
}
.sidebar nav a{
  display:flex;
  align-items:center;
  gap:12px;
  padding:13px 24px;
  margin:2px 10px;
  border-radius:10px;
  color:var(--gray-text);
  font-weight:600;
  font-size:14.5px;
  border-left:3px solid transparent;
  transition:.2s ease;
}
.sidebar nav a:hover{
  background:#f8f9fb;
  color:var(--navy);
}
.sidebar nav a.active{
  background:linear-gradient(90deg, #fff1ee 0%, #fff8f6 100%);
  color:var(--orange-dark);
  border-left:3px solid var(--orange);
  box-shadow:0 2px 8px rgba(255,111,91,0.08);
}
.sidebar nav a .icon{
  width:20px; text-align:center;
}

.main-content{
  flex:1;
  padding:30px 34px;
}

.page-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:26px;
  flex-wrap:wrap;
  gap:14px;
}
.page-header h1{
  font-size:24px;
  font-weight:800;
  color:var(--navy);
}
.page-header p{
  color:var(--gray-text);
  font-size:14px;
  margin-top:4px;
}

/* ---------------- CARDS ---------------- */
.card{
  background:var(--white);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:24px;
  position:relative;
  overflow:hidden;
  border:1px solid rgba(231,235,240,0.6);
  transition:box-shadow .25s ease, transform .25s ease;
}
.card:hover{
  box-shadow:var(--shadow-lg);
}
.card-corner{
  position:absolute;
  top:-10px; right:-10px;
  width:90px; height:90px;
  background:var(--grad-brand);
  border-bottom-left-radius:100%;
  opacity:.12;
}

.stats-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(210px,1fr));
  gap:20px;
  margin-bottom:28px;
}
.stat-card{
  background:var(--white);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:22px;
  display:flex;
  align-items:center;
  gap:16px;
  position:relative;
  overflow:hidden;
  border:1px solid rgba(231,235,240,0.6);
  transition:transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-lg);
}
.stat-icon{
  width:52px;height:52px;
  border-radius:14px;
  background:var(--grad-brand);
  box-shadow:0 8px 18px rgba(255,111,91,0.28);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:22px;
  flex-shrink:0;
}
.stat-value{font-size:27px; font-weight:800; color:var(--navy); letter-spacing:-.3px;}
.stat-label{font-size:13px; color:var(--gray-text); font-weight:600;}

/* ---------------- TABLES ---------------- */
.table-card{
  background:var(--white);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  border:1px solid rgba(231,235,240,0.6);
}
.table-card-head{
  padding:20px 24px;
  border-bottom:1px solid var(--border);
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
}
.table-card-head h3{font-size:17px; font-weight:700; letter-spacing:-.2px;}

table{
  width:100%;
  border-collapse:collapse;
}
thead th{
  text-align:left;
  font-size:11.5px;
  text-transform:uppercase;
  letter-spacing:.6px;
  color:var(--gray-text);
  padding:14px 24px;
  background:#f8fafc;
  font-weight:700;
}
tbody td{
  padding:15px 24px;
  border-top:1px solid var(--border);
  font-size:14px;
  color:var(--navy);
}
tbody tr{transition:background .15s ease;}
tbody tr:hover{background:#fdf6f5;}

.badge{
  display:inline-block;
  padding:4px 12px;
  border-radius:30px;
  font-size:12px;
  font-weight:700;
}
.badge-success{background:#e6f9f0; color:var(--success);}
.badge-danger{background:#fdeceb; color:var(--danger);}
.badge-orange{background:#fff1ee; color:var(--orange-dark);}

/* ---------------- BUTTONS ---------------- */
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:11px 22px;
  border-radius:10px;
  font-weight:700;
  font-size:14px;
  border:none;
  cursor:pointer;
  transition:.2s ease;
}
.btn-primary{
  background:var(--grad-brand);
  color:#fff;
  box-shadow:0 6px 16px rgba(255,111,91,0.28);
}
.btn-primary:hover{
  box-shadow:0 8px 20px rgba(255,111,91,0.38);
  transform:translateY(-1px);
}
.btn-outline{background:#fff; color:var(--navy); border:1.5px solid var(--border);}
.btn-outline:hover{border-color:var(--orange); color:var(--orange-dark); background:#fff8f7;}
.btn-danger{background:#fff; color:var(--danger); border:1.5px solid #fbdcd9;}
.btn-danger:hover{background:var(--danger); color:#fff;}
.btn-sm{padding:7px 14px; font-size:12.5px; border-radius:8px;}
.btn-block{width:100%; justify-content:center;}
.btn:active{transform:translateY(0);}

/* ---------------- FORMS ---------------- */
.form-group{margin-bottom:18px;}
.form-group label{
  display:block;
  font-size:13.5px;
  font-weight:700;
  margin-bottom:7px;
  color:var(--navy);
}
.form-group .hint{
  font-size:12px;
  color:var(--gray-text);
  margin-top:5px;
}
input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=date],
textarea,
select{
  width:100%;
  padding:12px 14px;
  border:1.5px solid var(--border);
  border-radius:10px;
  font-size:14px;
  font-family:inherit;
  color:var(--navy);
  background:#fbfcfe;
  transition:.2s ease;
}
input:focus, textarea:focus, select:focus{
  outline:none;
  border-color:var(--orange);
  background:#fff;
  box-shadow:0 0 0 4px rgba(255,111,91,0.1);
}
textarea{resize:vertical; min-height:90px;}

/* ---------------- AUTH PAGES ---------------- */
.auth-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--grad-navy);
  background-image: url('https://www.aljazeera.com/wp-content/uploads/2021/04/370573518.jpg');
  padding:20px;
}
.auth-box{
  background:#fff;
  width:100%;
  max-width:400px;
  border-radius:20px;
  padding:42px 36px;
  box-shadow:0 25px 60px rgba(0,0,0,0.3);
  position:relative;
  overflow:hidden;
}
.auth-box::before{
  content:'';
  position:absolute;
  top:-40px; right:-40px;
  width:140px;height:140px;
  background:var(--grad-brand);
  opacity:.14;
  border-radius:50%;
}
.auth-box::after{
  content:'';
  position:absolute;
  bottom:-50px; left:-50px;
  width:120px;height:120px;
  background:var(--navy);
  opacity:.06;
  border-radius:50%;
}
.auth-logo{
  text-align:center;
  font-size:29px;
  font-weight:800;
  margin-bottom:6px;
  letter-spacing:.5px;
}
.auth-logo span{
  background:var(--grad-brand);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.auth-subtitle{
  text-align:center;
  color:var(--gray-text);
  font-size:13.5px;
  margin-bottom:28px;
}
.alert{
  padding:12px 16px;
  border-radius:10px;
  font-size:13.5px;
  margin-bottom:18px;
  font-weight:600;
}
.alert-danger{background:#fdeceb; color:var(--danger);}
.alert-success{background:#e6f9f0; color:var(--success);}

/* ---------------- MODAL ---------------- */
.modal-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(22,35,60,0.55);
  align-items:center;
  justify-content:center;
  z-index:200;
  padding:20px;
}
.modal-overlay.open{display:flex;}
.modal-box{
  background:#fff;
  border-radius:18px;
  width:100%;
  max-width:480px;
  max-height:88vh;
  overflow-y:auto;
  padding:28px;
  box-shadow:0 30px 70px rgba(0,0,0,0.25);
  animation: modalPop .2s ease;
}
.modal-box h3{font-size:19px; font-weight:800; margin-bottom:18px; letter-spacing:-.2px;}

@keyframes modalPop{
  from{opacity:0; transform:translateY(10px) scale(.98);}
  to{opacity:1; transform:translateY(0) scale(1);}
}
.modal-close{
  position:absolute;
  top:16px; right:20px;
  cursor:pointer;
  font-size:20px;
  color:var(--gray-text);
  background:none;
  border:none;
}

/* ---------------- FIELD BUILDER ---------------- */
.field-row{
  display:grid;
  grid-template-columns:2fr 1.2fr 1fr auto;
  gap:10px;
  align-items:center;
  background:#f8fafc;
  padding:12px;
  border-radius:10px;
  margin-bottom:10px;
}
.field-row .remove-field{
  background:#fdeceb;
  color:var(--danger);
  border:none;
  border-radius:8px;
  width:34px;height:34px;
  cursor:pointer;
  font-weight:800;
}

/* dynamic user-facing form fields */
.dyn-field{margin-bottom:16px;}

/* ---------------- MISC ---------------- */
.empty-state{
  text-align:center;
  padding:50px 20px;
  color:var(--gray-text);
}
.empty-state .icon{font-size:44px; margin-bottom:14px;}

.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
}
@media(max-width:640px){
  .grid-2{grid-template-columns:1fr;}
  .field-row{grid-template-columns:1fr 1fr; grid-template-rows:auto auto;}
}

.section-toggle{display:flex; align-items:center; gap:10px;}
.hamburger{display:none; background:none; border:none; font-size:22px; color:var(--navy); cursor:pointer;}

@media(max-width:860px){
  .sidebar{
    position:fixed;
    left:-260px;
    top:74px;
    height:calc(100vh - 74px);
    z-index:100;
    transition:.3s;
    box-shadow:0 10px 30px rgba(0,0,0,0.15);
  }
  .sidebar.open{left:0;}
  .hamburger{display:block;}
  .main-content{padding:20px;}
}
