/* ================================
   RESET & GLOBAL STYLES
================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #1f2937;
  --gray: #6b7280;
  --light-gray: #f3f4f6;
  --border: #e5e7eb;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  min-height: 100vh;
  padding: 40px 20px;
  line-height: 1.6;
}

/* ================================
   CONTAINER & LAYOUT
================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.logout-btn-fixed {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logout-btn-fixed:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ================================
   HEADER
================================ */

.header {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 0.5s ease;
}

.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--light-gray);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 20px;
  background: var(--light-gray);
  color: var(--dark);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  transform: translateX(-5px);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.header h1 {
  font-size: 42px;
  color: var(--dark);
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--gray);
  font-size: 18px;
}

/* ================================
   SECTIONS
================================ */

.form-section,
.links-section {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  animation: fadeInUp 0.5s ease;
}

.form-section h2,
.links-section h2 {
  font-size: 28px;
  color: var(--dark);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ================================
   FORM STYLES
================================ */

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
  font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group small {
  display: block;
  color: var(--gray);
  font-size: 14px;
  margin-top: 6px;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* File Input */
.file-input-wrapper {
  position: relative;
}

.form-group input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-group input[type="file"]:hover {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.05);
}

.image-preview {
  margin-top: 15px;
  display: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.image-preview.active {
  display: block;
}

.image-preview img {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
}

/* ================================
   BUTTONS
================================ */

.submit-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.reset-btn,
.refresh-btn {
  background: var(--light-gray);
  color: var(--dark);
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover,
.refresh-btn:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* ================================
   RESULT SECTION
================================ */

.result-section {
  margin-top: 30px;
  padding: 30px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 16px;
  border: 2px solid var(--primary);
  animation: slideIn 0.4s ease;
}

.result-section h3 {
  color: var(--success);
  font-size: 24px;
  margin-bottom: 20px;
}

.result-box {
  margin-bottom: 20px;
}

.result-box label {
  display: block;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 10px;
}

.link-display {
  display: flex;
  gap: 10px;
}

.link-display input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: white;
  font-family: monospace;
}

.copy-btn {
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}

.result-info {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.result-info p {
  margin-bottom: 10px;
  color: var(--gray);
}

.result-info strong {
  color: var(--dark);
}

.result-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.result-info a:hover {
  text-decoration: underline;
}

.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.view-list-btn {
  display: inline-block;
  padding: 12px 30px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 16px;
}

.view-list-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ================================
   LINKS LIST
================================ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.section-header h2 {
  margin-bottom: 0;
}

.links-list {
  display: grid;
  gap: 20px;
}

.link-card {
  background: var(--light-gray);
  padding: 20px;
  border-radius: 12px;
  border: 2px solid var(--border);
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease;
}

.link-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.link-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 15px;
}

.link-card-title {
  flex: 1;
}

.link-card-title h3 {
  color: var(--dark);
  font-size: 18px;
  margin-bottom: 5px;
}

.link-card-title p {
  color: var(--gray);
  font-size: 14px;
}

.link-card-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn {
  background: var(--primary);
  color: white;
}

.view-btn:hover {
  background: var(--secondary);
}

.delete-btn {
  background: var(--danger);
  color: white;
}

.delete-btn:hover {
  background: #dc2626;
}

.copy-btn {
  background: var(--success);
  color: white;
}

.copy-btn:hover {
  background: #059669;
}

.link-card-image {
  margin-bottom: 15px;
  border-radius: 10px;
  overflow: hidden;
}

.link-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.link-card-info {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.link-card-info-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.link-card-info-item strong {
  color: var(--dark);
  min-width: 80px;
}

.link-card-info-item span {
  color: var(--gray);
  word-break: break-all;
}

.link-card-info-item a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.link-card-info-item a:hover {
  text-decoration: underline;
}

/* ================================
   LOADING & SPINNER
================================ */

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray);
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--dark);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 20px;
}

.empty-state-btn {
  display: inline-block;
  padding: 12px 30px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.empty-state-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ================================
   TOAST NOTIFICATION
================================ */

.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--dark);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 1000;
  max-width: 400px;
  font-weight: 500;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ================================
   ANIMATIONS
================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 768px) {
  body {
    padding: 20px 15px;
  }

  .header-nav {
    flex-direction: column;
    gap: 10px;
  }

  .back-btn,
  .nav-link {
    width: 100%;
    justify-content: center;
  }

  .result-actions {
    flex-direction: column;
  }

  .reset-btn,
  .view-list-btn {
    width: 100%;
  }

  .header h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 16px;
  }

  .form-section,
  .links-section {
    padding: 25px 20px;
  }

  .section-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .link-display {
    flex-direction: column;
  }

  .link-card-actions {
    flex-direction: column;
    width: 100%;
  }

  .action-btn {
    width: 100%;
  }

  .toast {
    right: 15px;
    left: 15px;
    bottom: 20px;
  }
}

