﻿/* ============================================
   Link3 Clone - Main Stylesheet
   ============================================ */

:root {
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-light: #A78BFA;
  --bg: #FAFAFA;
  --card-bg: #FFFFFF;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== NAVBAR ==================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-brand i {
  margin-right: 0.5rem;
}

/* ==================== HERO ==================== */
.landing-page {
  min-height: 100vh;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), #EC4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

/* ==================== CREATE FORM ==================== */
.create-form {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group input:disabled,
.form-group textarea:disabled {
  background: var(--bg);
  cursor: not-allowed;
}

.url-preview {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.url-preview strong {
  color: var(--primary);
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-back {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

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

.btn-preview {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-right: 0.5rem;
  transition: all 0.2s;
}

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

.btn-save {
  padding: 0.5rem 1.5rem;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: white;
  font-weight: 600;
  transition: background 0.2s;
}

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

/* ==================== FEATURES ==================== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==================== EDITOR NAVBAR ==================== */
.editor-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-right {
  display: flex;
  gap: 0.75rem;
}

/* ==================== EDITOR LAYOUT ==================== */
.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.editor-sidebar {
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ==================== MODULE LIST ==================== */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: 2px solid transparent;
}

.module-item:hover {
  background: var(--bg);
}

.module-item.active {
  background: rgba(124, 58, 237, 0.05);
  border-color: var(--primary-light);
}

.module-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
  color: var(--primary);
  flex-shrink: 0;
}

.module-info {
  flex: 1;
  min-width: 0;
}

.module-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.module-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.module-item:hover .module-actions {
  opacity: 1;
}

.module-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 0.8rem;
}

.module-actions button:hover {
  background: var(--border);
}

.module-actions .btn-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.drag-handle {
  cursor: grab !important;
}

.drag-handle:active {
  cursor: grabbing;
}

/* ==================== ADD MODULE GRID ==================== */
.add-module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.add-module-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.add-module-btn:hover {
  background: rgba(124, 58, 237, 0.05);
  border-color: var(--primary-light);
  color: var(--primary);
}

.add-module-btn i {
  font-size: 1.2rem;
}

.add-module-btn.full-width {
  grid-column: 1 / -1;
  flex-direction: row;
  gap: 0.5rem;
  padding: 0.5rem;
}

/* ==================== EDITOR MAIN ==================== */
.editor-main {
  background: var(--bg);
  overflow-y: auto;
  padding: 2rem;
}

.module-editor {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.module-editor h3 {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.editor-fields .form-group {
  margin-bottom: 1rem;
}

.empty-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}

.empty-editor i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

/* ==================== PREVIEW PANEL ==================== */
.editor-preview {
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}

.editor-preview h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-align: center;
}

.preview-frame {
  display: flex;
  justify-content: center;
}

.phone-frame {
  width: 280px;
  min-height: 500px;
  border: 3px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-lg);
}

.preview-content {
  padding: 2rem 1.25rem;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.preview-header {
  text-align: center;
  padding: 1rem 0;
}

.preview-avatar,
.preview-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.75rem;
}

.preview-avatar-placeholder {
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.preview-header h2 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.preview-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.preview-module {
  width: 100%;
}

.preview-link-mod {
  display: block;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  text-align: center;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.preview-link-mod:hover {
  background: var(--primary-dark);
}

.preview-image-mod {
  width: 100%;
  border-radius: 8px;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg);
}

.preview-text-mod {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.5rem;
}

.preview-divider-mod {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.preview-qr-mod {
  text-align: center;
}

.preview-qr-mod p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.preview-qr-image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: var(--bg);
}

.preview-donate-mod {
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, #FEE2E2, #FECACA);
  border-radius: 8px;
}

.preview-donate-mod p {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.preview-donate-mod button {
  padding: 0.5rem 1.5rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
}

.preview-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.social-icon {
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: color 0.2s;
}

.social-icon:hover {
  color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .editor-sidebar,
  .editor-preview {
    border: none;
    border-bottom: 1px solid var(--border);
  }
  
  .add-module-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .create-form {
    padding: 1.5rem;
  }
  
  .features {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .add-module-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .editor-navbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fa-spin {
  animation: spin 1s linear infinite;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--text);
  color: white;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.toast.success {
  background: var(--success);
}

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