/* --- Global Reset & Layout --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
}

body {
  background: #f5f7fa;
  color: #222;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 30px auto;
  padding: 20px;
}

/* --- Header --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

header h2 {
  font-size: 1.8em;
  color: #333;
  margin-bottom: 10px;
}

header a {
  text-decoration: none;
  background: #007bff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  margin-left: 8px;
  transition: background 0.2s;
}

header a:hover {
  background: #0056c7;
}

/* --- Dashboard Buttons (under header) --- */
header + div a,
header + div button {
  text-decoration: none;
  background: #007bff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  margin-right: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  font-size: 0.9em;
}

header + div a:hover,
header + div button:hover {
  background: #0056c7;
}

/* --- Success/Error Messages --- */
.success, .error {
  padding: 10px 15px;
  margin: 10px 0;
  border-radius: 6px;
  font-size: 0.95em;
}

.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- Gallery Grid (Gallery Page) --- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  justify-items: center;
  align-items: stretch;
}

/* --- File Card --- */
.file-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  max-width: 280px;
  height: 100%;
  padding: 12px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.file-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

/* --- Thumbnail --- */
.file-thumb {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.file-thumb img,
.file-thumb video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* --- Caption --- */
.caption {
  font-size: 0.9em;
  color: #555;
  margin-bottom: 6px;
}

/* --- Embed URL --- */
.embed-url {
  width: 100%;
  margin-bottom: 10px;
  padding: 6px;
  font-size: 0.85em;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f9f9f9;
  color: #333;
}

/* --- Action Buttons (Gallery) --- */
.actions {
  margin-top: auto;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

/* --- Icon Buttons --- */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #e9ecef;
  transform: scale(1.1);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: #333;
}

/* --- Individual Button Colors --- */
.icon-copy svg { stroke: #007bff; }
.icon-move svg { stroke: #17a2b8; }
.icon-rename svg { stroke: #ffc107; }
.icon-delete svg { stroke: #dc3545; }

/* --- Gallery List (Dashboard) --- */
.gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 15px;
}

.gallery-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 15px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.gallery-card a {
  display: inline-block;
  margin: 8px 0;
  text-decoration: none;
  background: #17a2b8;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}

.gallery-card a:hover {
  background: #117a8b;
}

/* --- Modal Styling (both pages) --- */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  margin: 80px auto;
  position: relative;
}

.modal-content h3 {
  margin-bottom: 15px;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 8px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.modal-content button {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-content button:hover {
  background: #0056c7;
}

.close {
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 22px;
  cursor: pointer;
}
