/* ==========================================================================
   ITPCo Security Portal — Core Stylesheet
   Design System: Persian RTL, Tailwind-augmented
   ========================================================================== */

/* Mobile menu toggle */
.mobile-menu-closed { display: none; }

/* Hide mobile menu on desktop even when open */
@media (min-width: 768px) {
  [data-mobile-menu] { display: none !important; }
}

/* --------------------------------------------------------------------------
   1. Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Palette */
  --itp-purple:      #6B4C9A;
  --itp-green:       #66CC99;
  --itp-dark:        #2D1B4E;
  --itp-light-gray:  #E6E2EF;
  --itp-blue:        #4A7ACF;
  --itp-deep-green:  #3E8F6A;

  /* Semantic Colors */
  --c-bg:            #F9FAFB;
  --c-surface:       #FFFFFF;
  --c-text:          #1F2937;
  --c-text-muted:    #6B7280;
  --c-border:        #E5E7EB;

  /* Severity (Security Alerts) */
  --sev-critical:    #DC2626;
  --sev-high:        #EA580C;
  --sev-medium:      #D97706;
  --sev-low:         #16A34A;
  --sev-info:        #2563EB;

  /* Spacing scale */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;
  --sp-4: 1rem;    --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-10: 2.5rem; --sp-12: 3rem;
  --sp-16: 4rem;   --sp-20: 5rem;   --sp-24: 6rem;

  /* Radius */
  --r-sm: .375rem; --r-md: .5rem; --r-lg: .75rem;
  --r-xl: 1rem;    --r-2xl: 1.25rem; --r-full: 9999px;

  /* Shadows */
  --sh-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --sh-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.05);
  --sh-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.05);
  --sh-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);
  --sh-2xl:0 25px 50px -12px rgba(0,0,0,.25);
  --sh-glow-green: 0 0 20px rgba(102,204,153,.4);
  --sh-glow-purple: 0 0 24px rgba(107,76,154,.35);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 300ms ease;
  --t-slow: 500ms ease;

  /* Layout */
  --container-max: 80rem; /* 1280px */
}

/* --------------------------------------------------------------------------
   2. Base / Reset additions
   -------------------------------------------------------------------------- */
html { scroll-behavior: smooth; }
html:focus-within { scroll-behavior: smooth; }
body {
  font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Focus-visible for keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--itp-purple);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.7;
}
::selection { background: var(--itp-green); color: var(--itp-dark); }

/* --------------------------------------------------------------------------
   3. Hero & Decorative Backgrounds
   -------------------------------------------------------------------------- */
.hero-bg {
  background: linear-gradient(135deg, var(--itp-dark) 0%, #4a2f75 100%);
  position: relative;
  overflow: hidden;
}
.hero-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-bg > * { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   4. Card Variants
   -------------------------------------------------------------------------- */
.glass-card {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-xl);
}
/* LTR card body for English-content cards */
.ltr-body { direction: ltr; text-align: left; }
.feature-card {
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  padding: var(--sp-8);
  box-shadow: var(--sh-lg);
  border-top: 4px solid var(--itp-green);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.feature-card:hover { box-shadow: var(--sh-2xl); transform: translateY(-4px); }
.feature-card.--purple { border-top-color: var(--itp-purple); }
.feature-card.--blue   { border-top-color: var(--itp-blue); }
.feature-card.--orange { border-top-color: #F97316; }
.feature-card.--deep   { border-top-color: var(--itp-deep-green); }

/* News / Article cards */
.news-card {
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: var(--sh-md);
  display: flex;
  flex-direction: column;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.news-card:hover { transform: translateY(-6px); box-shadow: var(--sh-2xl); }
.news-card__media {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--itp-purple), var(--itp-dark));
  position: relative;
  overflow: hidden;
}
.news-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow); }
.news-card:hover .news-card__media img { transform: scale(1.06); }
.news-card__category {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  background: var(--itp-green); color: var(--itp-dark);
  font-size: .75rem; font-weight: 700;
  padding: .25rem .75rem; border-radius: var(--r-full);
}
.news-card__body { padding: var(--sp-6); flex: 1; display: flex; flex-direction: column; }
.news-card__title { font-size: 1.125rem; font-weight: 700; color: var(--itp-dark); margin-bottom: var(--sp-2); line-height: 1.5; }
.news-card__excerpt { color: var(--c-text-muted); font-size: .9rem; flex: 1; margin-bottom: var(--sp-4); }
.news-card__meta { display:flex; justify-content: space-between; align-items: center; font-size:.8rem; color: var(--c-text-muted); border-top:1px solid var(--c-border); padding-top: var(--sp-3); }

/* --------------------------------------------------------------------------
   5. Security Alert — Severity Badges
   -------------------------------------------------------------------------- */
.alert-card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  border-right: 6px solid var(--sev-info);
  box-shadow: var(--sh-md);
  transition: box-shadow var(--t-base);
}
.alert-card:hover { box-shadow: var(--sh-xl); }
.alert-card.--critical { border-right-color: var(--sev-critical); }
.alert-card.--high     { border-right-color: var(--sev-high); }
.alert-card.--medium   { border-right-color: var(--sev-medium); }
.alert-card.--low      { border-right-color: var(--sev-low); }

.severity-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .75rem; font-weight: 700;
  padding: .25rem .75rem; border-radius: var(--r-full);
  text-transform: uppercase; letter-spacing: .03em;
}
.severity-badge::before {
  content:''; width:.5rem; height:.5rem; border-radius: var(--r-full); background: currentColor;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.severity-badge.--critical { background: rgba(220,38,38,.1);  color: var(--sev-critical); }
.severity-badge.--high     { background: rgba(234,88,12,.1);  color: var(--sev-high); }
.severity-badge.--medium   { background: rgba(217,119,6,.1);  color: var(--sev-medium); }
.severity-badge.--low      { background: rgba(22,163,74,.1);  color: var(--sev-low); }
.severity-badge.--info     { background: rgba(37,99,235,.1);  color: var(--sev-info); }
@keyframes pulse-dot {
  0%,100% { transform: scale(1);   opacity: 1; }
  50%     { transform: scale(1.4); opacity: .6; }
}

/* --------------------------------------------------------------------------
   6. Download Card
   -------------------------------------------------------------------------- */
.download-card {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  transition: all var(--t-base);
}
.download-card:hover {
  border-color: var(--itp-purple);
  box-shadow: var(--sh-lg);
  transform: translateY(-2px);
}
.download-card__icon {
  width: 56px; height: 56px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--itp-purple), var(--itp-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.download-card__title { font-weight: 700; color: var(--itp-dark); margin-bottom: .25rem; }
.download-card__meta { font-size: .8rem; color: var(--c-text-muted); }
.download-card__btn {
  background: var(--itp-green); color: var(--itp-dark);
  padding: .5rem 1rem; border-radius: var(--r-md);
  font-weight: 700; font-size: .85rem; white-space: nowrap;
  transition: background var(--t-fast);
}
.download-card__btn:hover { background: var(--itp-purple); color: #fff; }

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 700; padding: .75rem 2rem;
  border-radius: var(--r-lg); transition: all var(--t-base);
  cursor: pointer; border: none;
}
.btn--primary { background: var(--itp-green); color: var(--itp-dark); box-shadow: var(--sh-glow-green); }
.btn--primary:hover { background: #fff; transform: translateY(-2px); }
.btn--ghost   { background: transparent; color: #fff; border: 1px solid #fff; }
.btn--ghost:hover { background: #fff; color: var(--itp-purple); }
.btn--purple  { background: var(--itp-purple); color: #fff; }
.btn--purple:hover { background: var(--itp-dark); box-shadow: var(--sh-glow-purple); }
.btn--pill    { border-radius: var(--r-full); padding: .5rem 1.25rem; }

/* --------------------------------------------------------------------------
   8. Section Title (reusable)
   -------------------------------------------------------------------------- */
.section-title { text-align: center; margin-bottom: var(--sp-10); }
.section-title h2 { font-size: clamp(1.25rem, 2.5vw, 1.6rem); font-weight: 800; color: var(--itp-dark); margin-bottom: var(--sp-3); }
.section-title__underline { height: 3px; width: 56px; background: var(--itp-green); margin: 0 auto; border-radius: var(--r-full); }
.section-title__underline.--purple { background: var(--itp-purple); }
.section-title p { margin-top: var(--sp-3); font-size: 0.9rem; color: var(--c-text-muted); }

/* --------------------------------------------------------------------------
   9. Feedback Widget
   -------------------------------------------------------------------------- */
.feedback-widget {
  margin-top: var(--sp-12);
  background: linear-gradient(135deg, rgba(107,76,154,.06), rgba(102,204,153,.06));
  border: 1px solid var(--c-border);
  border-radius: var(--r-2xl);
  padding: var(--sp-8);
}
.feedback-widget h3 { font-weight: 700; color: var(--itp-dark); margin-bottom: var(--sp-2); }
.feedback-widget p  { color: var(--c-text-muted); margin-bottom: var(--sp-5); font-size: .95rem; }
.feedback-stars { display: inline-flex; gap: .25rem; direction: ltr; }
.feedback-stars button {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.75rem; color: #D1D5DB; transition: color var(--t-fast), transform var(--t-fast);
}
.feedback-stars button:hover, .feedback-stars button.is-active { color: #F59E0B; transform: scale(1.1); }
.feedback-widget textarea {
  width: 100%; border: 1px solid var(--c-border); border-radius: var(--r-lg);
  padding: var(--sp-3); font-family: inherit; resize: vertical; min-height: 90px;
  margin-top: var(--sp-4);
}
.feedback-widget textarea:focus { outline: 2px solid var(--itp-purple); border-color: transparent; }
.feedback-widget .feedback-msg { margin-top: var(--sp-3); font-size: .9rem; font-weight: 700; }
.feedback-widget .feedback-msg.--ok { color: var(--itp-deep-green); }

/* --------------------------------------------------------------------------
   10. Filters Bar
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  background: var(--c-surface); border: 1px solid var(--c-border);
  padding: var(--sp-4); border-radius: var(--r-xl);
  margin-bottom: var(--sp-8);
}
.filter-chip {
  padding: .5rem 1.1rem; border-radius: var(--r-full);
  background: var(--c-bg); color: var(--c-text-muted);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--t-fast);
}
.filter-chip:hover { color: var(--itp-purple); border-color: var(--itp-light-gray); }
.filter-chip.is-active { background: var(--itp-purple); color: #fff; border-color: var(--itp-purple); }

/* --------------------------------------------------------------------------
   11. Animations
   -------------------------------------------------------------------------- */
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-20px); }
}
.animate-float { animation: float 6s ease-in-out infinite; }

@keyframes blob {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(30px,-50px) scale(1.1); }
  66%     { transform: translate(-20px,20px) scale(.9); }
}
.animate-blob { animation: blob 7s infinite; }
.animation-delay-2000 { animation-delay: 2s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; }
.reveal.is-visible { animation: fadeUp .7s ease-out forwards; }

/* --------------------------------------------------------------------------
   12. Admin Panel
   -------------------------------------------------------------------------- */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--itp-dark); color: #fff; padding: var(--sp-6); }
.admin-sidebar a {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-radius: var(--r-md);
  color: rgba(255,255,255,.7); transition: all var(--t-fast);
}
.admin-sidebar a:hover, .admin-sidebar a.is-active {
  background: rgba(255,255,255,.08); color: #fff;
}
.admin-main { padding: var(--sp-8); background: var(--c-bg); }
.admin-stat {
  background: var(--c-surface); border-radius: var(--r-xl);
  padding: var(--sp-6); box-shadow: var(--sh-sm);
  border-top: 3px solid var(--itp-purple);
}
.admin-stat__value { font-size: 2rem; font-weight: 800; color: var(--itp-dark); }
.admin-stat__label { font-size: .9rem; color: var(--c-text-muted); }
.admin-table { width: 100%; background: var(--c-surface); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-sm); }
.admin-table th { background: var(--itp-light-gray); padding: var(--sp-3) var(--sp-4); text-align: right; font-size:.85rem; color: var(--itp-dark); }
.admin-table td { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-border); font-size: .9rem; }
.admin-table tr:hover td { background: #FAFAFA; }

@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: sticky; top: 0; z-index: 40; }
}

/* --------------------------------------------------------------------------
   13. Utility: page header band
   -------------------------------------------------------------------------- */
.page-header {
  background: linear-gradient(135deg, var(--itp-dark), #4a2f75);
  color: #fff; padding: var(--sp-20) 0 var(--sp-16);
  text-align: center; position: relative; overflow: hidden;
}
.page-header h1 { font-size: clamp(2rem,4vw,3rem); font-weight: 800; }
.page-header p  { color: rgba(255,255,255,.7); max-width: 640px; margin: var(--sp-3) auto 0; }
.page-header::after {
  content:''; position: absolute; left:0; right:0; bottom:-1px; height:60px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 1440 60' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q360 60 720 30 T1440 30 L1440 60 L0 60 Z' fill='%23F9FAFB'/%3E%3C/svg%3E") no-repeat center/cover;
}

/* --------------------------------------------------------------------------
   14. Responsive helpers
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .feature-card { padding: var(--sp-6); }
  .feedback-widget { padding: var(--sp-6); }
}

/* ==========================================================================
   15. MOBILE OPTIMIZATION — compact layout for small screens
   ========================================================================== */
@media (max-width: 767px) {

  /* ── Global spacing compression ── */
  section { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .py-16  { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .py-20  { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
  .py-24  { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
  .py-32  { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
  .pb-32  { padding-bottom: 2rem !important; }
  .pt-20  { padding-top: 2rem !important; }
  .mb-16  { margin-bottom: 1.5rem !important; }
  .mb-12  { margin-bottom: 1rem !important; }
  .mb-10  { margin-bottom: 1rem !important; }
  .gap-12 { gap: 1.5rem !important; }
  .gap-10 { gap: 1rem !important; }
  .gap-8  { gap: 0.875rem !important; }

  /* ── Typography scale down ── */
  h1, .text-5xl, .text-6xl { font-size: 1.7rem !important; line-height: 1.25 !important; }
  h2, .text-4xl             { font-size: 1.4rem !important; line-height: 1.3 !important; }
  h3, .text-3xl             { font-size: 1.15rem !important; }
  h4, .text-2xl             { font-size: 1.05rem !important; }
  .text-xl, .text-lg        { font-size: 0.95rem !important; }

  /* ── Hero sections ── */
  .hero-bg, .news-hero, .page-header {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  .page-header h1 { font-size: 1.5rem !important; }
  .page-header p  { font-size: 0.85rem !important; }

  /* ── Grid: force 2-col for card grids ── */
  .grid.grid-cols-1.md\:grid-cols-2,
  .grid.grid-cols-1.md\:grid-cols-3,
  .grid.grid-cols-1.sm\:grid-cols-2,
  .grid.grid-cols-1.lg\:grid-cols-3,
  .grid.grid-cols-1.lg\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  /* ── Cards: compact padding ── */
  .glass-card, .feature-card, .stat-chip {
    padding: 0.875rem !important;
    border-radius: 12px !important;
  }

  /* ── Stat chips: 2-col grid ── */
  .stat-chip { padding: 0.75rem !important; }
  .stat-chip .text-3xl, .stat-chip .text-4xl { font-size: 1.4rem !important; }

  /* ── News / Alert / Article cards ── */
  .news-card, .alert-card, .article-card, [class*="card"] {
    border-radius: 12px !important;
  }

  /* ── Card image heights: shrink ── */
  .license-img-wrap { height: 140px !important; }
  img.object-cover  { max-height: 160px; }

  /* ── Filter bar: scroll horizontal ── */
  .filter-bar, [class*="filter"] {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem !important;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }

  /* ── Buttons: full-width where stacked ── */
  .flex.flex-col.sm\:flex-row > a,
  .flex.flex-col.sm\:flex-row > button {
    width: 100% !important; text-align: center !important;
  }

  /* ── CTA sections ── */
  [class*="rounded-2xl"] .flex-col,
  [class*="rounded-2xl"] .md\:flex-row {
    gap: 1rem !important;
  }

  /* ── Padding inner containers ── */
  .p-8, .p-10, .p-12 { padding: 1rem !important; }
  .px-8 { padding-left: 1rem !important; padding-right: 1rem !important; }

  /* ── Table: horizontal scroll ── */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Hide decorative blobs ── */
  .hero-blob, .animate-blob { display: none !important; }

  /* ── Contact form: stack nicely ── */
  form .grid { grid-template-columns: 1fr !important; gap: 0.75rem !important; }

  /* ── Section titles: less margin ── */
  .text-center.mb-12, .text-center.mb-16 { margin-bottom: 1.25rem !important; }
}
