/*
Theme Name: مصانع مصر v3
Theme URI: https://masane3masr.com
Author: مصانع مصر
Author URI: https://masane3masr.com
Description: ثيم دليل المصانع المصرية - يدعم إدارة بروفايلات المصانع والتجار
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: masane3masr
Tags: rtl-language, custom-colors, custom-logo, directory, business
*/

/* =============================================
   ROOT VARIABLES
   ============================================= */
:root {
  --red: #c8102e;
  --red-dark: #9e0b22;
  --red-light: #fff0f2;
  --gold: #d4a843;
  --dark: #1a1a2e;
  --mid: #2d2d44;
  --light: #f5f4f0;
  --white: #ffffff;
  --text: #2c2c3a;
  --muted: #6b6b80;
  --border: #e2e0d8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Tajawal', Tahoma, Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--red); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--red-dark); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* =============================================
   LAYOUT
   ============================================= */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-sm {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =============================================
   HEADER / NAVBAR
   ============================================= */
#masthead {
  background: var(--dark);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  gap: 20px;
}

/* Logo */
.site-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--red);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
}

.site-title {
  color: white;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1;
}

.site-title span { color: var(--gold); }

/* Nav Menu */
.main-navigation ul {
  display: flex;
  gap: 2px;
}

.main-navigation a {
  color: rgba(255,255,255,0.72);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  display: block;
  transition: all 0.2s;
}

.main-navigation a:hover,
.main-navigation .current-menu-item > a {
  color: white;
  background: rgba(255,255,255,0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-add-factory {
  background: var(--red);
  color: white !important;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.btn-add-factory:hover {
  background: var(--red-dark) !important;
  transform: translateY(-1px);
}

.btn-lang {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 5px 11px;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-lang:hover { color: white; border-color: rgba(255,255,255,0.45); }

/* Hamburger mobile */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 22px;
  padding: 5px;
}

/* =============================================
   SEARCH STRIP (below header)
   ============================================= */
.search-strip {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.search-form {
  display: flex;
  gap: 10px;
  max-width: 700px;
}

.search-form input[type="search"] {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  direction: rtl;
  color: var(--text);
}

.search-form input[type="search"]:focus { border-color: var(--red); }

.search-form button {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-form button:hover { background: var(--red-dark); }

/* Category Filter Pills */
.category-filter {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--light);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.filter-pill:hover,
.filter-pill.active {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* =============================================
   HERO (Homepage)
   ============================================= */
.hero-section {
  background: linear-gradient(135deg, var(--dark) 0%, var(--mid) 60%, #1f1f35 100%);
  padding: 72px 0 80px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.hero-section::before,
.hero-section::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-section::before {
  top: -80px; left: -80px;
  width: 400px; height: 400px;
  background: var(--red);
  opacity: 0.05;
}

.hero-section::after {
  bottom: -60px; right: 10%;
  width: 300px; height: 300px;
  background: var(--gold);
  opacity: 0.06;
}

.hero-section h1 {
  font-size: 2.6rem;
  font-weight: 900;
  color: white;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.hero-section h1 span { color: var(--gold); }

.hero-section p {
  font-size: 16px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 36px;
  position: relative;
  z-index: 1;
}

.hero-search {
  display: flex;
  gap: 10px;
  max-width: 580px;
  margin: 0 auto 28px;
  position: relative;
  z-index: 1;
}

.hero-search input {
  flex: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  direction: rtl;
}

.hero-search button {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.hero-search button:hover { background: var(--red-dark); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  position: relative;
  z-index: 1;
}

.hero-stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
}

.hero-stat-lbl {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h2, .card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.card-header-icon {
  width: 32px;
  height: 32px;
  background: var(--red-light);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.card-body { padding: 20px; }

/* =============================================
   FACTORY LISTING CARD (Grid)
   ============================================= */
.factories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.factory-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.factory-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.11);
  transform: translateY(-2px);
}

.factory-card-thumb {
  height: 130px;
  background: linear-gradient(135deg, #1a1a2e, #2d2d44);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  position: relative;
  overflow: hidden;
}

.factory-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.factory-type-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.factory-card-body { padding: 16px; flex: 1; }

.factory-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: block;
}

.factory-card-name:hover { color: var(--red); }

.factory-card-location {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.factory-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.factory-card-tag {
  background: #f0f4ff;
  color: #2547a1;
  border: 1px solid #d0dbf5;
  border-radius: 20px;
  font-size: 11px;
  padding: 2px 9px;
}

.factory-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.verified-dot {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #1a7a3f;
  font-weight: 600;
}

.verified-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #25d366;
  border-radius: 50%;
}

.btn-view-profile {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 5px 13px;
  border-radius: 20px;
  transition: all 0.15s;
}

.btn-view-profile:hover {
  background: var(--red);
  color: white;
}

/* =============================================
   FACTORY PROFILE PAGE
   ============================================= */
.profile-hero {
  background: linear-gradient(135deg, var(--dark) 0%, var(--mid) 60%, #1f1f35 100%);
  position: relative;
  overflow: hidden;
  padding: 36px 0 0;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 300px; height: 300px;
  background: var(--red);
  opacity: 0.06;
  border-radius: 50%;
  pointer-events: none;
}

.profile-hero-inner {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.profile-avatar {
  width: 105px;
  height: 105px;
  border-radius: 14px;
  border: 3px solid rgba(255,255,255,0.15);
  background: #2a2a40;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info { flex: 1; padding-bottom: 18px; }

.profile-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.profile-name {
  font-size: 24px;
  font-weight: 800;
  color: white;
  margin-bottom: 6px;
  line-height: 1.2;
}

.profile-location {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Profile Tabs */
.profile-tabs-bar {
  background: var(--dark);
  border-top: 1px solid rgba(255,255,255,0.07);
}

.profile-tabs {
  display: flex;
  gap: 4px;
}

.profile-tab {
  color: rgba(255,255,255,0.5);
  font-size: 13.5px;
  font-weight: 500;
  padding: 13px 18px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-tab:hover { color: rgba(255,255,255,0.85); }
.profile-tab.active, .profile-tab:hover { color: white; border-bottom-color: var(--red); }

/* Profile Content Layout */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 22px;
  margin: 28px 0 48px;
}

.profile-main { display: flex; flex-direction: column; gap: 20px; }
.profile-sidebar { display: flex; flex-direction: column; gap: 18px; }

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-box {
  background: white;
  padding: 18px 12px;
  text-align: center;
}

.stat-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--red);
  display: block;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-item label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.info-item p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Products Tags */
.products-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-tag {
  background: #f0f4ff;
  color: #2547a1;
  border: 1px solid #c8d5f8;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.product-tag:hover { background: #2547a1; color: white; }

/* About Text */
.about-text {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--text);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #e8e6de;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: transform 0.2s, opacity 0.2s;
}

.gallery-item:hover { transform: scale(0.96); opacity: 0.9; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* =============================================
   SIDEBAR COMPONENTS
   ============================================= */
/* Contact Box */
.contact-box {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.contact-box-header {
  background: var(--red);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-box-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.contact-row:last-child { border-bottom: none; }
.contact-row:hover { background: #fafaf8; }

.contact-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.contact-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  direction: ltr;
  display: block;
}

a.contact-value:hover { color: var(--red); }

.contact-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ci-phone { background: #eaf7ee; }
.ci-email { background: #fff0f0; }
.ci-web   { background: #f0f2ff; }
.ci-map   { background: #fff8e6; }
.ci-wa    { background: #e7f7e7; }

/* CTA Buttons */
.sidebar-ctas { padding: 14px 18px 18px; }

.btn-cta {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s;
  margin-bottom: 10px;
}

.btn-cta:last-child { margin-bottom: 0; }

.btn-cta-primary { background: var(--red); color: white; }
.btn-cta-primary:hover { background: var(--red-dark); color: white; transform: translateY(-1px); }

.btn-cta-wa { background: #25d366; color: white; }
.btn-cta-wa:hover { background: #1da851; color: white; transform: translateY(-1px); }

/* Verified Badge */
.verified-card {
  background: linear-gradient(135deg, #fff8e6, #fffbf0);
  border: 1px solid #e8c96a;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.verified-card .v-icon { font-size: 28px; flex-shrink: 0; }
.verified-card h4 { font-size: 13px; font-weight: 700; color: #7a5400; margin-bottom: 2px; }
.verified-card p  { font-size: 11px; color: #a07020; }

/* Address Card */
.address-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.address-map-placeholder {
  width: 100%;
  height: 150px;
  background: #e8e6de;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.address-map-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}

.map-pin {
  width: 34px; height: 34px;
  background: var(--red);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(200,16,46,0.4);
}

.map-pin::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) rotate(45deg);
  width: 11px; height: 11px;
  background: white;
  border-radius: 50%;
}

.address-body { padding: 14px 16px; }
.address-body p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.address-body a { font-size: 13px; font-weight: 600; display: inline-block; margin-top: 10px; }

/* =============================================
   BREADCRUMB
   ============================================= */
.breadcrumb {
  padding: 14px 0;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb .sep { opacity: 0.4; }

/* =============================================
   DASHBOARD
   ============================================= */
.dashboard-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin: 32px 0 48px;
  min-height: 600px;
}

/* Dashboard Sidebar */
.dash-sidebar {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  align-self: start;
}

.dash-user-info {
  background: linear-gradient(135deg, var(--dark), var(--mid));
  padding: 20px 16px;
  text-align: center;
}

.dash-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--red);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border: 3px solid rgba(255,255,255,0.15);
}

.dash-user-name { color: white; font-size: 14px; font-weight: 700; }
.dash-user-role { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 3px; }

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}

.dash-nav-item:last-child { border-bottom: none; }
.dash-nav-item:hover { background: var(--light); color: var(--red); }
.dash-nav-item.active { background: var(--red-light); color: var(--red); font-weight: 700; }
.dash-nav-item .icon { font-size: 17px; width: 22px; text-align: center; }

/* Dashboard Content */
.dash-content { display: flex; flex-direction: column; gap: 20px; }

/* Dashboard Stats */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.dash-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-stat-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.dsi-red    { background: #fff0f2; }
.dsi-blue   { background: #f0f2ff; }
.dsi-green  { background: #eaf7ee; }
.dsi-gold   { background: #fff8e6; }

.dash-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: block;
  line-height: 1;
}

.dash-stat-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  background: var(--light);
  padding: 11px 14px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafaf8; }

.table-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-active  { background: #eaf7ee; color: #1a7a3f; }
.badge-pending { background: #fff8e6; color: #a07020; }
.badge-premium { background: #f0f2ff; color: #2547a1; }

.table-actions { display: flex; gap: 6px; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text);
}

.btn-sm:hover { border-color: var(--red); color: var(--red); }
.btn-sm.danger:hover { border-color: #c00; color: #c00; }

/* Form Styles */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label span { color: var(--red); }

.form-control {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  direction: rtl;
  color: var(--text);
  background: white;
}

.form-control:focus { border-color: var(--red); }

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

select.form-control { cursor: pointer; }

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

.btn-primary {
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover { border-color: var(--red); color: var(--red); }

/* =============================================
   SUBSCRIPTION PLANS
   ============================================= */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.plan-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
  position: relative;
}

.plan-card.featured {
  border-color: var(--red);
  box-shadow: 0 4px 20px rgba(200,16,46,0.12);
}

.plan-card.featured::before {
  content: '⭐ الأكثر طلباً';
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 0 0 8px 8px;
}

.plan-header { padding: 28px 22px 20px; text-align: center; border-bottom: 1px solid var(--border); }
.plan-name { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.plan-price .amount { font-size: 36px; font-weight: 900; color: var(--red); }
.plan-price .period { font-size: 13px; color: var(--muted); }

.plan-features { padding: 20px 22px; }
.plan-feature { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid #f5f4f0; }
.plan-feature:last-child { border-bottom: none; }
.plan-feature .check { color: #25d366; font-weight: 700; }
.plan-feature .cross { color: #ccc; }

.plan-footer { padding: 16px 22px 22px; }
.plan-footer .btn-cta { margin: 0; }

/* =============================================
   FOOTER
   ============================================= */
#colophon {
  background: var(--dark);
  color: rgba(255,255,255,0.55);
  padding: 48px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

.footer-brand .logo-icon { margin-bottom: 12px; }
.footer-brand p { font-size: 13px; line-height: 1.8; margin-top: 10px; }

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--red);
  display: inline-block;
}

.footer-col ul { display: flex; flex-direction: column; gap: 8px; }

.footer-col a {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  transition: color 0.2s;
}

.footer-col a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.footer-bottom a { color: rgba(255,255,255,0.45); margin-right: 16px; }
.footer-bottom a:hover { color: white; }

.footer-logo-text { color: white; font-size: 17px; font-weight: 800; }
.footer-logo-text span { color: var(--gold); }

/* =============================================
   WIDGETS
   ============================================= */
.widget { margin-bottom: 28px; }
.widget-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--red); display: inline-block; }

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}

.page-link {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: white;
  transition: all 0.15s;
}

.page-link:hover, .page-link.current {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

/* =============================================
   NOTICES / ALERTS
   ============================================= */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-success { background: #eaf7ee; color: #1a7a3f; border: 1px solid #b7e4c7; }
.notice-error   { background: #fff0f0; color: #9e0b22; border: 1px solid #f5c0c0; }
.notice-info    { background: #f0f2ff; color: #2547a1; border: 1px solid #c8d5f8; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .dash-stats  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main-navigation { display: none; }
  .main-navigation.open { display: block; position: absolute; top: 66px; right: 0; left: 0; background: var(--dark); padding: 12px; z-index: 999; }
  .main-navigation.open ul { flex-direction: column; }
  .menu-toggle { display: block; }
  .btn-add-factory { display: none; }

  .profile-layout { grid-template-columns: 1fr; }
  .dashboard-wrap  { grid-template-columns: 1fr; }
  .plans-grid      { grid-template-columns: 1fr; }
  .footer-grid     { grid-template-columns: 1fr; }
  .info-grid       { grid-template-columns: 1fr; }
  .form-row        { grid-template-columns: 1fr; }
  .factories-grid  { grid-template-columns: 1fr; }
  .dash-stats      { grid-template-columns: repeat(2, 1fr); }
  .hero-section h1 { font-size: 1.8rem; }
  .hero-stats      { gap: 20px; }
}

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .stats-row  { grid-template-columns: repeat(3, 1fr); }
  .container, .container-sm { padding: 0 12px; }
}
