/* FlagCraft CMYK Studio - Core Styles & Layers Panel */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&family=Tajawal:wght@400;500;700;900&family=Amiri:ital,wght@0,400;0,700;1,400&family=El+Messiri:wght@400;600;700&family=Changa:wght@400;600;800&family=Almarai:wght@400;700;800&family=Readex+Pro:wght@400;600;700&family=Alexandria:wght@400;600;800&family=Lalezar&family=Reem+Kufi:wght@500;700&family=Lemonada:wght@500;700&family=Scheherazade+New:wght@600;700&family=Mada:wght@600;800&family=Montserrat:wght@400;600;800;900&family=Bebas+Neue&family=Oswald:wght@500;700&family=Anton&family=Poppins:wght@600;800&family=Roboto:wght@500;700;900&family=Inter:wght@600;800&family=Playfair+Display:wght@700;900&family=Pacifico&display=swap');

:root {
  --bg-dark: #0b0f17;
  --bg-studio: #121824;
  --bg-sidebar: #182030;
  --bg-panel: #20293a;
  --bg-hover: #2a364d;
  
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.4);
  
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-cmyk-c: #00aeef;
  --accent-cmyk-m: #ec008c;
  --accent-cmyk-y: #fff200;
  --accent-cmyk-k: #231f20;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --border-color: #374151;
  --border-focus: #60a5fa;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  direction: rtl;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* App Header Navbar */
.app-header {
  height: 60px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #00aeef, #ec008c);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 12px rgba(236, 0, 140, 0.4);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmyk-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: linear-gradient(90deg, var(--accent-cmyk-c), var(--accent-cmyk-m), var(--accent-cmyk-y));
  color: #000;
  font-weight: 900;
  border-radius: 12px;
  letter-spacing: 1px;
}

.top-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tool {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-tool.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Studio Main Layout */
.app-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.sidebar-nav {
  width: 84px;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
  z-index: 20;
}

.nav-tab-btn {
  width: 68px;
  height: 60px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-tab-btn i {
  font-size: 1.25rem;
}

.nav-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-tab-btn.active {
  background: var(--bg-panel);
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.sidebar-panel {
  width: 340px;
  background-color: var(--bg-studio);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 15;
}

.sidebar-panel::-webkit-scrollbar {
  width: 6px;
}
.sidebar-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

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

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-input, .form-select {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.flag-type-card {
  background: var(--bg-panel);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.flag-type-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.flag-type-card.active {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.flag-icon-svg {
  width: 44px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-card-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.template-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.template-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.template-preview-box {
  width: 100%;
  height: 100px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.template-title-bar {
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  background: var(--bg-sidebar);
}

/* Layers Panel Styles */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.layer-item:hover {
  border-color: var(--border-focus);
}

.layer-item.active {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.12);
}

.btn-layer-act {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.btn-layer-act:hover {
  color: #fff;
}

.upload-dropzone {
  border: 2px dashed var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-dropzone:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.canvas-area {
  flex: 1;
  background-color: var(--bg-studio);
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.canvas-info-bar {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(24, 32, 48, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.canvas-wrapper-outer {
  position: relative;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.object-inspector {
  position: absolute;
  bottom: 16px;
  background: rgba(24, 32, 48, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  transition: all 0.2s ease;
  max-width: 90%;
  flex-wrap: wrap;
}

.object-inspector.hidden {
  display: none;
}

.inspector-group {
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--border-color);
  padding-right: 12px;
}
.inspector-group:last-child {
  border-right: none;
  padding-right: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-container {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 1050px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mockup-display-stage {
  width: 100%;
  height: 520px;
  background: radial-gradient(circle at center, #1f2937 0%, #0b0f17 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.mockup-canvas-container {
  position: relative;
  height: 95%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-right: 4px solid var(--accent-primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
