/* ============================================
   SNAPLINKS - URL SHORTENER STYLES
   ============================================ */

/* VARIABLES */
:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --danger-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --background: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
}

/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { color: var(--text-secondary); }

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 2rem 1rem;
  box-shadow: var(--shadow-lg);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo h1 {
  font-size: 1.75rem;
  margin: 0;
}

.logo-icon {
  font-size: 2rem;
}

.tagline {
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-size: 1rem;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ============================================
   SECTIONS
   ============================================ */

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h2 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--text-primary);
}

/* Disabled state */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   INPUTS
   ============================================ */

.input-field,
.url-input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  transition: var(--transition);
  font-family: inherit;
}

.input-field:focus,
.url-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.result-input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--text-primary);
}

.result-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* ============================================
   URL INPUT SECTION
   ============================================ */

.input-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .input-wrapper {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    width: 100%;
  }
}

/* ============================================
   ERROR & HINT TEXT
   ============================================ */

.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-message.hidden {
  display: none;
}

.error-message::before {
  content: "⚠️";
}

.hint {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ============================================
   ADVANCED OPTIONS
   ============================================ */

.advanced-options-section {
  margin-bottom: 2rem;
}

#advancedToggle {
  width: 100%;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

#advancedToggle:hover {
  background: var(--background);
}

#toggleIcon {
  transition: var(--transition);
}

#advancedToggle.expanded #toggleIcon {
  transform: rotate(180deg);
}

.advanced-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: 400px;
  overflow: hidden;
  transition: var(--transition);
}

.advanced-panel.hidden {
  display: none;
}

.advanced-panel.show {
  display: flex;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 400px;
  }
}

.option-group {
  display: flex;
  flex-direction: column;
}

.option-group label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* ============================================
   RESULT SECTION
   ============================================ */

.result-section {
  margin-top: 2rem;
}

.result-section.hidden {
  display: none;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-bottom: 1px solid var(--border);
}

.result-header h3 {
  margin: 0;
}

.result-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.result-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: center;
}

.result-row .label {
  font-weight: 600;
  color: var(--text-primary);
}

.result-value {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.result-text {
  word-break: break-all;
  margin: 0;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .result-row {
    grid-template-columns: 1fr;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   MODALS
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1001;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--background);
}

.modal-footer .btn {
  flex: 1;
}

@media (max-width: 600px) {
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    flex: 1;
  }
}

/* ============================================
   STATS CONTENT
   ============================================ */

.stats-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
}

.stat-label {
  font-weight: 600;
  color: var(--text-primary);
}

.stat-value {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.1rem;
}

.delete-warning {
  background: #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.delete-url {
  background: var(--background);
  padding: 1rem;
  border-radius: var(--radius);
  word-break: break-all;
  font-family: monospace;
  font-size: 0.9rem;
}

/* ============================================
   LOADING & SPINNER
   ============================================ */

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

.loading.hidden {
  display: none;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text-primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideInRight 0.3s ease;
}

.toast.hidden {
  display: none;
}

.toast.error {
  background: var(--danger-color);
}

.toast.success {
  background: var(--success-color);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .result-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
