/* Modern Photo Gallery CSS - Blue Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for consistent theming */
:root {
  --primary-blue: #2563eb;
  --primary-blue-dark: #1d4ed8;
  --primary-blue-light: #3b82f6;
  --secondary-blue: #dbeafe;
  --accent-blue: #60a5fa;
  --success-green: #10b981;
  --danger-red: #ef4444;
  --warning-orange: #f59e0b;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  min-height: 100vh;
  font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Header */
header {
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  margin: 0;
  font-size: 1.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-red) 0%, #f87171 100%);
  color: white;
}

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

#admin-btn, #back-btn, #logout-btn {
  composes: btn btn-primary;
}

#logout-btn {
  background: linear-gradient(135deg, var(--danger-red) 0%, #f87171 100%);
}

/* Main content */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Sections */
.section {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.section:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

#upload-section, #search-section {
  composes: section;
}

#upload-section h2 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

/* Form styles */
.form-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.form-row label {
  min-width: 100px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: var(--bg-primary);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:hover {
  border-color: var(--border-medium);
}

#category, #new-category, #tags, #file-input, #search-input, #category-filter {
  composes: form-control;
}

/* File input styling */
input[type="file"] {
  padding: 0.5rem;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="file"]:hover {
  border-color: var(--primary-blue);
  background: var(--secondary-blue);
}

/* Select styling */
select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

#search-input {
  max-width: 500px;
  margin: 0 auto;
  display: block;
  text-align: center;
  font-size: 1rem;
}

/* Drop area */
#drop-area {
  border: 3px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

#drop-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--secondary-blue) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#drop-area:hover::before {
  opacity: 0.3;
}

#drop-area.dragover {
  border-color: var(--primary-blue);
  background: var(--secondary-blue);
  color: var(--primary-blue);
  transform: scale(1.02);
}

#drop-area.dragover::before {
  opacity: 0.5;
}

/* Upload progress */
#upload-progress {
  margin-top: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, var(--success-green) 0%, #34d399 100%);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* Gallery */
#gallery-section {
  min-height: 400px;
}

#gallery.masonry {
  column-count: 4;
  column-gap: 1.5rem;
  margin-top: 2rem;
}

@media (max-width: 1200px) {
  #gallery.masonry {
    column-count: 3;
  }
}

@media (max-width: 900px) {
  #gallery.masonry {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  #gallery.masonry {
    column-count: 1;
  }
}

.gallery-item {
  break-inside: avoid;
  background: var(--bg-primary);
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
}

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

.gallery-item img {
  width: 100%;
  display: block;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-meta {
  padding: 1rem 1.5rem;
  background: var(--bg-primary);
}

.gallery-meta h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.gallery-meta p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Loading */
#loading {
  text-align: center;
  color: var(--text-secondary);
  margin: 3rem 0;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  display: block;
  margin: 5vh auto 2rem auto;
  max-width: 90vw;
  max-height: 70vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: slideIn 0.3s ease;
}

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

#modal-caption {
  color: white;
  text-align: center;
  margin: 1rem 0;
  font-size: 1.1rem;
  font-weight: 500;
}

.close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

#download-btn {
  display: block;
  margin: 0 auto 2rem auto;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  max-width: 200px;
}

#download-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Token modal */
#token-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

#token-form {
  background: var(--bg-primary);
  padding: 3rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border-light);
}

#token-form label {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

#token-form input {
  padding: 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all 0.2s ease;
}

#token-form input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#token-form button {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

#token-form button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Responsive design */
@media (max-width: 768px) {
  main {
    padding: 1rem;
  }
  
  header {
    padding: 1rem;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .section {
    padding: 1.5rem;
  }
  
  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .form-row label {
    min-width: auto;
    margin-bottom: 0.25rem;
  }
  
  .form-control {
    min-width: auto;
  }
  
  #drop-area {
    padding: 2rem 1rem;
  }
  
  #gallery.masonry {
    column-count: 1;
    column-gap: 1rem;
  }
  
  .gallery-item {
    margin-bottom: 1rem;
  }
  
  #token-form {
    padding: 2rem;
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.8rem;
  }
  
  #token-form {
    padding: 1.5rem;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mt-2 {
  margin-top: 1rem;
}

.hidden {
  display: none;
}

/* Smooth scrolling for better UX */
html {
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
} 