/* ==========================================================================
   RESKA IMMOBILIARE - PANNELLO DI CONTROLLO CMS (NO-CODE ADMIN)
   Mobile-First Responsive Dashboard & Login System
   ========================================================================== */

:root {
  --primary: #FF6600;
  --primary-hover: #E55B00;
  --primary-light: #FFF4EC;
  --secondary: #1E293B;
  --secondary-dark: #0F172A;
  --bg-app: #F1F5F9;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 32px rgba(15, 23, 42, 0.14);
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. LOGIN SCREEN
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 102, 0, 0.16), transparent 45%),
              linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 20px;
  padding: 36px 30px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.login-brand img {
  height: 64px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--secondary-dark);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-alert {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.login-alert.show {
  display: block;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-main);
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.14);
}

textarea.form-control {
  min-height: 95px;
  resize: vertical;
  line-height: 1.5;
}

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

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==========================================================================
   2. DASHBOARD LAYOUT (SIDEBAR + MAIN WORKSPACE)
   ========================================================================== */
.cms-layout {
  display: none;
  min-height: 100vh;
}

.cms-layout.active {
  display: flex;
  flex-direction: column;
}

@media (min-width: 992px) {
  .cms-layout.active {
    flex-direction: row;
  }
}

.cms-sidebar {
  background: var(--secondary-dark);
  color: var(--white);
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 992px) {
  .cms-sidebar {
    width: 270px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
}

.sidebar-header {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}

.sidebar-brand img {
  height: 42px;
  width: auto;
}

.sidebar-brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.1;
}

.sidebar-brand-sub {
  font-size: 0.72rem;
  color: #FFA366;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  overflow-x: auto;
  padding: 10px 14px;
  gap: 6px;
}

@media (min-width: 992px) {
  .sidebar-nav {
    flex-direction: column;
    padding: 18px 14px;
    flex: 1;
  }
}

.sidebar-tab-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: #94A3B8;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-align: left;
}

.sidebar-tab-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-tab-btn.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.35);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cms-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cms-topbar {
  background: var(--white);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-info h1 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--secondary-dark);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.status-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
}

.cms-content {
  padding: 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.cms-pane {
  display: none;
}

.cms-pane.active {
  display: block;
}

/* ==========================================================================
   3. BUTTONS & CARDS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #FF6600 0%, #FF8533 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

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

.btn-outline {
  background: var(--white);
  color: var(--secondary);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #FEF2F2;
  color: var(--danger);
  border-color: #FECACA;
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.panel-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary-dark);
}

/* ==========================================================================
   4. PROPERTIES ADMIN GRID
   ========================================================================== */
.admin-prop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .admin-prop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1120px) {
  .admin-prop-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.admin-prop-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.admin-prop-thumb {
  position: relative;
  height: 190px;
  background: #0F172A;
}

.admin-prop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-prop-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.admin-prop-ape {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
}

.admin-prop-price {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: var(--white);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 4px 12px;
  border-radius: 999px;
}

.admin-prop-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-prop-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.admin-prop-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--secondary-dark);
}

.admin-prop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--secondary);
  margin-bottom: 16px;
}

.admin-prop-meta span {
  background: #F1F5F9;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.admin-prop-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   5. FORM GRIDS, WYSIWYG EDITOR & GALLERY MANAGER
   ========================================================================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

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

.wysiwyg-wrap {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}

.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
}

.wysiwyg-btn {
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  color: var(--secondary);
}

.wysiwyg-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.wysiwyg-editor {
  min-height: 170px;
  max-height: 340px;
  overflow-y: auto;
  padding: 14px;
  font-size: 0.92rem;
  line-height: 1.6;
  outline: none;
}

.wysiwyg-editor ul {
  padding-left: 20px;
  margin: 8px 0;
}

.wysiwyg-editor p {
  margin-bottom: 8px;
}

/* Gallery Uploader */
.gallery-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.gallery-thumb-item {
  position: relative;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: #0F172A;
}

.gallery-thumb-item.is-main {
  border-color: var(--primary);
}

.gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.92);
  color: var(--white);
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumb-main-tag {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--primary);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 26px 18px;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Media Grid */
.media-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 16px;
}

.media-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  display: flex;
  flex-direction: column;
}

.media-card-img {
  height: 130px;
  background: #0F172A;
}

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

.media-card-body {
  padding: 10px;
  font-size: 0.78rem;
}

.media-card-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

/* Modal */
.cms-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cms-modal-overlay.active {
  display: flex;
}

.cms-modal-card {
  background: var(--white);
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.cms-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cms-modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}

.cms-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #F8FAFC;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Leads Table */
.leads-table-wrap {
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.leads-table th,
.leads-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.leads-table th {
  background: #F8FAFC;
  font-weight: 700;
  color: var(--secondary);
}

/* Toast Notification */
.cms-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--secondary-dark);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.28s ease;
}

.cms-toast.show {
  transform: translateY(0);
  opacity: 1;
}
