* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: #202124;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.login-box {
  background: #fff;
  padding: 48px 40px;
  border-radius: 8px;
  border: 1px solid #dadce0;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 16px;
}

.login-box h1 {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
  color: #202124;
}

.login-box p {
  font-size: 16px;
  color: #5f6368;
  margin-bottom: 32px;
}

.login-box input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: #1a73e8;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box button:hover {
  background: #1765cc;
}

.file-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: #5f6368;
}

#loginError {
  color: #d93025;
  font-size: 14px;
  margin-top: 16px;
  display: none;
}

#loginError:not(:empty) {
  display: block;
}

#registerError {
  color: #d93025;
  font-size: 14px;
  margin-top: 16px;
  display: none;
}

#registerError:not(:empty) {
  display: block;
}

.login-alt-link {
  margin-top: 18px;
  font-size: 14px;
  text-align: center;
}

.login-alt-link a {
  color: #1a73e8;
  text-decoration: none;
}

.login-alt-link a:hover {
  text-decoration: underline;
}

/* Header */
header {
  background: #fff;
  border-bottom: 1px solid #dadce0;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 24px;
}

h1 {
  font-size: 22px;
  font-weight: 400;
  color: #5f6368;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f1f3f4;
  border-radius: 24px;
  font-size: 14px;
  color: #5f6368;
}

.user-usage {
  font-size: 12px;
  color: #9aa0a6;
  white-space: nowrap;
}

button {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #f8f9fa;
}

button.ghost {
  border: none;
  background: transparent;
}

button.ghost:hover {
  background: #f1f3f4;
}

/* Nav */
.nav {
  display: flex;
  gap: 4px;
}

.nav-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #5f6368;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nav-btn:hover {
  background: #f1f3f4;
}

.nav-btn.active {
  color: #1a73e8;
  background: #e8f0fe;
}

.path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  color: #5f6368;
}

/* Main */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.section {
  display: block;
}

.section.hidden {
  display: none;
}

/* Files */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filters {
  flex-wrap: wrap;
  align-items: center;
}

.filter-input {
  padding: 8px 10px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 14px;
  min-height: 34px;
}

.filter-input:focus {
  outline: none;
  border-color: #1a73e8;
}

.hint {
  color: #5f6368;
  font-size: 13px;
}

.list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.date-sep {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  color: #5f6368;
  font-size: 14px;
}

.date-sep .date-sep-line {
  flex: 1;
  height: 1px;
  background: #dadce0;
  opacity: 0.8;
}

.media-timeline {
  position: fixed;
  right: 10px;
  top: 160px;
  bottom: 70px;
  width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  background: #fff;
  z-index: 90;
  user-select: none;
  touch-action: none;
}

.media-timeline .year {
  font-size: 11px;
  color: #5f6368;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 10px;
}

.media-timeline .year.active {
  background: #f1f3f4;
  color: #202124;
}

.media-timeline-label {
  position: fixed;
  right: 56px;
  top: 180px;
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  background: #fff;
  color: #202124;
  font-size: 14px;
  z-index: 91;
}

.item {
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.item:hover {
  box-shadow: 0 1px 3px rgba(60,64,67,0.3);
}

.item-preview {
  width: 100%;
  height: 180px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
}

.item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-info {
  padding: 12px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
}

.item-actions button {
  padding: 6px 10px;
  font-size: 12px;
}

.file-icon {
  font-size: 40px;
  margin-bottom: 6px;
}

.file-ext {
  font-size: 12px;
  color: #5f6368;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 2px 8px;
}

.item-name {
  font-size: 14px;
  color: #202124;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  font-size: 12px;
  color: #5f6368;
}

/* Clipboard */
.clipboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.clipboard-header h2 {
  font-size: 20px;
  font-weight: 400;
  color: #202124;
}

.clipboard-actions {
  display: flex;
  gap: 8px;
}

#clipboardText {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

#clipboardText:focus {
  outline: none;
  border-color: #1a73e8;
}

#clipboardMeta {
  font-size: 12px;
  color: #5f6368;
  margin-top: 8px;
}

.clipboard-links {
  margin-top: 16px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.clipboard-links a {
  display: block;
  color: #1a73e8;
  text-decoration: none;
  margin-bottom: 8px;
  word-break: break-all;
}

.clipboard-links a:hover {
  text-decoration: underline;
}

.clipboard-history {
  margin-top: 16px;
}

.history-item {
  padding: 12px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 14px;
}

.history-item small {
  color: #5f6368;
  font-size: 12px;
}

/* Upload */
.upload-zone {
  border: 2px dashed #dadce0;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.upload-actions {
  margin-top: 16px;
}

.upload-btn {
  display: inline-block;
  padding: 10px 24px;
  background: #1a73e8;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.upload-btn:hover {
  background: #1765cc;
}

.upload-btn input {
  display: none;
}

.upload-zone:hover {
  border-color: #1a73e8;
}

.upload-zone.drag-over {
  border-color: #1a73e8;
  background: #e8f0fe;
}

.upload-status {
  font-size: 14px;
  color: #5f6368;
  margin-top: 12px;
}

.upload-progress {
  width: 100%;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.upload-progress.active {
  opacity: 1;
}

.upload-progress-bar {
  height: 100%;
  background: #1a73e8;
  width: 0%;
  transition: width 0.3s;
}

.actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
}

.lightbox {
  width: 90vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #dadce0;
}

#previewBody {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

#previewBody img,
#previewBody video {
  max-width: 100%;
  max-height: 100%;
}

.lightbox-meta {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid #dadce0;
  border-bottom: 1px solid #dadce0;
  align-items: flex-end;
  flex-wrap: wrap;
}

.lightbox-status {
  flex-basis: 100%;
  padding-bottom: 4px;
}

.lightbox-meta .meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  flex: 1;
}

.lightbox-meta label {
  font-size: 12px;
  color: #5f6368;
}

.lightbox-meta input {
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 14px;
}

.lightbox-meta input:focus {
  outline: none;
  border-color: #1a73e8;
}

.lightbox-footer {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid #dadce0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #202124;
  color: #fff;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 2000;
}

.toast.hidden {
  display: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  color: #5f6368;
  font-size: 14px;
  border-top: 1px solid #dadce0;
}

/* Utilities */
.hidden {
  display: none !important;
}

button.danger {
  color: #d93025;
}

button.danger:hover {
  background: #fce8e6;
}
