/* ============ GLOBAL STYLES ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #0f172a;
  --light: #f8fafc;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --text: #374151;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

/* ============ NAVBAR ============ */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid var(--primary);
}

.nav-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-brand i {
  font-size: 1.8rem;
}

.nav-menu {
  display: flex;
  gap: 30px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

.nav-stats {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--gray-600);
  font-weight: 600;
}

/* ============ MAIN LAYOUT ============ */
.main-container {
  display: flex;
  gap: 30px;
  padding: 30px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 280px;
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow-lg);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.sidebar-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--gray-100);
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar-section h3 {
  font-size: 1rem;
  margin-bottom: 15px;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-section h3 i {
  color: var(--primary);
  font-size: 1.2rem;
}

.upload-zone {
  border: 3px dashed var(--primary);
  border-radius: 10px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--gray-50);
}

.upload-zone:hover {
  border-color: var(--secondary);
  background: rgba(236, 72, 153, 0.05);
}

.upload-zone i {
  font-size: 2.5rem;
  color: var(--primary);
  display: block;
  margin-bottom: 10px;
}

.upload-zone p {
  font-size: 0.9rem;
  color: var(--text);
}

.quick-effects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.effect-btn {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.effect-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.tools-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-btn {
  padding: 12px 15px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-btn:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
}

/* ============ MAIN CONTENT ============ */
.main-content {
  flex: 1;
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  min-height: calc(100vh - 140px);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ SECTION HEADERS ============ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-header h2 {
  font-size: 1.8rem;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-header h2 i {
  color: var(--primary);
  font-size: 2rem;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  padding: 10px 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  min-width: 200px;
}

.search-box:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sort-select {
  padding: 10px 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  background: white;
  transition: all 0.3s ease;
}

.sort-select:hover,
.sort-select:focus {
  border-color: var(--primary);
  outline: none;
}

/* ============ GALLERY GRID ============ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--gray-100);
  aspect-ratio: 1;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

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

.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.edit-btn {
  background: var(--primary);
  color: white;
  width: 100%;
}

.edit-btn:hover {
  background: var(--primary-dark);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--gray-400);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
}

/* ============ EDITOR ============ */
.editor-wrapper {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 30px;
}

.editor-preview-area {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 20px;
}

.preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
}

.preview-container img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.preview-info {
  margin-top: 15px;
  font-size: 0.9rem;
  color: var(--gray-500);
  text-align: center;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-panel h3 {
  font-size: 1.3rem;
  color: var(--dark);
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-section label {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95rem;
}

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

input[type="number"],
input[type="text"],
select {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.full-select {
  width: 100%;
}

.slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: var(--shadow-md);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ BUTTONS ============ */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), #db2777);
  color: white;
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

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

.btn-success:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

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

.btn-danger:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.btn-info:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ============ TEMPLATES ============ */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.template-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  box-shadow: var(--shadow-md);
}

.template-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-xl);
}

.template-card i {
  font-size: 3rem;
  margin-bottom: 15px;
  display: block;
}

.template-card h4 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.template-card p {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ============ ANALYTICS ============ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 25px;
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
}

.stat-card i {
  font-size: 2.5rem;
}

.stat-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 0.9rem;
  opacity: 0.9;
}

.stats-details {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 25px;
}

/* ============ RESULTS CONTAINER ============ */
.results-container {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 25px;
  margin-top: 30px;
}

.results-container h3 {
  margin-bottom: 20px;
  color: var(--dark);
}

#socialSizesDisplay {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.size-result {
  background: white;
  border-radius: 8px;
  padding: 15px;
  border: 2px solid var(--border);
}

.size-result h4 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1rem;
}

.size-result p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 10px;
  word-break: break-all;
}

.size-result button {
  padding: 8px 15px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.size-result button:hover {
  background: var(--primary-dark);
}

/* ============ MODAL ============ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 15px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.advanced-modal {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--gray-400);
  transition: color 0.3s ease;
}

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

.modal-body {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ============ NOTIFICATION ============ */
.notification {
  position: fixed;
  top: 100px;
  right: 20px;
  padding: 15px 25px;
  background: var(--success);
  color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 400px;
  z-index: 3000;
}

.notification.error {
  background: var(--danger);
}

.notification.warning {
  background: var(--warning);
}

.notification.info {
  background: var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============ PROGRESS BAR ============ */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  z-index: 2500;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  animation: progress 0.5s ease;
}

@keyframes progress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
    gap: 20px;
  }

  .sidebar {
    width: 100%;
    position: relative;
    top: auto;
  }

  .editor-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    gap: 15px;
    padding: 15px;
  }

  .nav-menu {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .quick-effects {
    grid-template-columns: repeat(3, 1fr);
  }

  .templates-grid,
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .templates-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .main-content {
    padding: 15px;
  }

  .sidebar {
    padding: 15px;
  }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}
