@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
  --primary: #1e3a8a;
  --primary-hover: #1e40af;
  --secondary: #0d9488;
  --secondary-hover: #0f766e;
  --accent: #f59e0b;
  --dark-bg: #0f172a;
  --card-bg: #ffffff;
  --card-dark: #1e293b;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0284c7 100%);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  direction: rtl;
  text-align: right;
  background: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}

/* Header & Navbar */
.navbar {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: white;
}

.nav-brand img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, #ffffff 0%, #e0f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: #334155;
  color: white;
}

.btn-secondary:hover {
  background: #475569;
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

.btn-outline-dark {
  background: transparent;
  border: 1.5px solid #cbd5e1;
  color: #334155;
}

.btn-outline-dark:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Hero Section */
.hero-section {
  background: var(--bg-gradient);
  color: white;
  padding: 4rem 2rem 6rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
  animation: pulse 10s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 900;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #cbd5e1;
  margin-bottom: 2rem;
  font-weight: 400;
}

/* Container */
.main-container {
  max-width: 1280px;
  margin: -3rem auto 4rem auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

/* Grid & Cards */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  border-color: #cbd5e1;
}

.form-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  border-top: 5px solid var(--primary);
}

.form-card.service_eval { border-top-color: #10b981; }
.form-card.suggestion { border-top-color: #06b6d4; }
.form-card.complaint { border-top-color: #f59e0b; }
.form-card.inspection_objection { border-top-color: #ef4444; }

.form-card-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.2rem auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: #f1f5f9;
  color: var(--primary);
  transition: var(--transition);
}

.form-card:hover .form-card-icon {
  transform: scale(1.1) rotate(5deg);
  background: var(--primary);
  color: white;
}

.form-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-main);
}

.form-card-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

/* Restricted Badge */
.restricted-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

/* Dashboard Component */
.dashboard-header {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.dash-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 55px;
  height: 55px;
  background: linear-gradient(135deg, #1e3a8a, #0284c7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.dash-title-area h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
}

.dash-role-badge {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  margin-top: 0.2rem;
}

/* Stats Cards */
.stat-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.stat-icon {
  width: 55px;
  height: 55px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #047857); }
.stat-icon.yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #b91c1c); }

.stat-value { font-size: 1.8rem; font-weight: 800; color: #0f172a; line-height: 1; }
.stat-label { font-size: 0.88rem; color: #64748b; margin-top: 0.2rem; }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  background: white;
  border: 1px solid #e2e8f0;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.custom-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  padding: 1rem 1.2rem;
  font-size: 0.9rem;
  border-bottom: 2px solid #e2e8f0;
}

.custom-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.93rem;
  color: #334155;
}

.custom-table tr:hover {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-under_review { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-closed { background: #f1f5f9; color: #475569; }

.badge-branch {
  background: #e2e8f0;
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.form-label span.req {
  color: #ef4444;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.8rem 1.1rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
  background: white;
  color: #0f172a;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 110px;
}

/* Rating Stars */
.rating-stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.4rem;
}

.rating-stars input { display: none; }

.rating-stars label {
  font-size: 2.2rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: var(--transition);
}

.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label {
  color: #f59e0b;
}

/* Printable / PDF Styling */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .navbar, .btn, .no-print, header, footer {
    display: none !important;
  }
  .printable-area {
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
  .pdf-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 20px;
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  padding: 2rem;
  box-shadow: var(--glass-shadow);
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-backdrop.active .modal-box {
  transform: translateY(0);
}

/* Alerts */
.alert {
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-title { font-size: 2rem; }
  .nav-container { flex-direction: column; gap: 1rem; }
  .dashboard-header { flex-direction: column; align-items: flex-start; }
}
