/* ==========================================================================
   Apple Design System - Modern Frosted Glass & Interactive Micro-Animations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --apple-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 50%, #eef2f7 100%);
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-blue-glow: rgba(0, 113, 227, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.05), 0 0 1px rgba(0, 0, 0, 0.1);
  --glass-shadow-hover: 0 30px 60px -12px rgba(0, 113, 227, 0.12), 0 0 1px rgba(0, 0, 0, 0.15);
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #a1a1a6;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --transition-apple: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Global Reset & Ambient Canvas ---------- */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--apple-font);
  background: #f5f5f7;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Ambient Lighting Blobs */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  animation: floatAmbient 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.ambient-blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #e0c3fc 0%, #8ec5fc 100%);
  top: -100px;
  left: -100px;
}

.ambient-blob-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #cfd9df 0%, #e2ebf0 100%);
  bottom: -150px;
  right: -100px;
  animation-delay: -7s;
}

.ambient-blob-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #a1c4fd 0%, #c2e9fb 100%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -12s;
}

@keyframes floatAmbient {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ---------- Typography ---------- */
h1.apple-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 8px 0;
  background: linear-gradient(180deg, #1d1d1f 0%, #434344 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

p.apple-subtitle {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
  margin: 0 0 36px 0;
  line-height: 1.47;
}

/* ---------- Apple Glass Cards ---------- */
.apple-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: 32px;
  transition: var(--transition-apple);
}

.apple-card-hover {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.apple-card-hover:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: var(--glass-shadow-hover);
  border-color: rgba(0, 113, 227, 0.3);
}

.apple-card-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: 0.6s;
}

.apple-card-hover:hover::before {
  left: 100%;
}

/* Card Icons */
.card-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #f0f3f8);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), inset 0 1px 1px #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 20px;
  transition: var(--transition-apple);
}

.apple-card-hover:hover .card-icon-wrapper {
  transform: scale(1.1) rotate(-3deg);
  background: linear-gradient(145deg, #0071e3, #005bb5);
  color: white;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Apple Interactive Dropzone ---------- */
.apple-dropzone {
  border: 2px dashed rgba(0, 113, 227, 0.3);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: var(--transition-apple);
  position: relative;
  overflow: hidden;
}

.apple-dropzone:hover, .apple-dropzone.dragover {
  border-color: var(--accent-blue);
  background: rgba(240, 246, 255, 0.85);
  box-shadow: 0 0 0 6px var(--accent-blue-glow);
  transform: scale(1.008);
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  transition: var(--transition-apple);
  display: inline-block;
}

.apple-dropzone:hover .dropzone-icon {
  transform: translateY(-4px) scale(1.1);
}

.dropzone-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.dropzone-subtext {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- File List & Reordering ---------- */
.apple-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: var(--transition-apple);
}

.apple-file-item:hover {
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 113, 227, 0.2);
  transform: translateY(-2px);
}

.apple-file-item.dragging {
  opacity: 0.4;
  transform: scale(0.98);
  border-style: dashed;
}

.drag-handle {
  cursor: grab;
  font-size: 16px;
  color: var(--text-tertiary);
  padding: 0 6px;
  user-select: none;
  transition: var(--transition-fast);
}

.drag-handle:hover {
  color: var(--text-primary);
}

/* ---------- Apple Badges & Pills ---------- */
.apple-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent-blue);
  border: 1px solid rgba(0, 113, 227, 0.15);
}

.apple-pill-secondary {
  background: rgba(134, 134, 139, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(134, 134, 139, 0.2);
}

/* ---------- Apple Buttons ---------- */
.apple-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 980px; /* Apple signature capsule button */
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: none;
  cursor: pointer;
  transition: var(--transition-apple);
  text-decoration: none;
  user-select: none;
}

.apple-btn-primary {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.35);
}

.apple-btn-primary:hover {
  background: var(--accent-blue-hover);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.45);
  transform: translateY(-1px);
}

.apple-btn-primary:disabled {
  background: #c7c7cc;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.apple-btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.apple-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.apple-btn-danger {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.2);
}

.apple-btn-danger:hover {
  background: #ff3b30;
  color: white;
  box-shadow: 0 4px 14px rgba(255, 59, 48, 0.35);
}

/* ---------- Flash Messages Toast ---------- */
.apple-flash {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

.apple-flash.error {
  background: rgba(255, 242, 242, 0.9);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: #d70015;
}

.apple-flash.success {
  background: rgba(242, 255, 245, 0.9);
  border: 1px solid rgba(52, 199, 89, 0.2);
  color: #248a3d;
}

.apple-flash.info {
  background: rgba(242, 248, 255, 0.9);
  border: 1px solid rgba(0, 113, 227, 0.2);
  color: #0071e3;
}

/* ---------- Apple Loader Overlay ---------- */
.apple-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.apple-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.apple-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 113, 227, 0.15);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: appleSpin 0.8s linear infinite;
}

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

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