/* Reset i zmienne - jasny motyw z zielonym akcentem */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f5f5;
  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --accent: #2e7d32;
  --accent-hover: #1b5e20;
  --accent-light: #c8e6c9;
  --success: #2e7d32;
  --success-light: #c8e6c9;
  --warning: #f9a825;
  --warning-light: #fff8e1;
  --danger: #c62828;
  --danger-light: #ffebee;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --header-bg: #2e7d32;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Custom scrollbar */
.movies-grid::-webkit-scrollbar,
.movies-list::-webkit-scrollbar {
  width: 8px;
}

.movies-grid::-webkit-scrollbar-track,
.movies-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.movies-grid::-webkit-scrollbar-thumb,
.movies-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.movies-grid::-webkit-scrollbar-thumb:hover,
.movies-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Layout */
.container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: var(--header-bg);
  border-bottom: none;
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

header .container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Header main - główny wiersz z logo, centrum i auth */
.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

/* Header center - search + filtry pod spodem */
.header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 1170px;
}

/* Header filters - filtry i statystyki pod searchem */
.header-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 15px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  padding: 10px 0;
}

.logo img {
  height: 130px;
  width: auto;
}


/* Auth buttons */
.auth-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  flex-shrink: 0;
}

.auth-section .username {
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
}

.auth-section button {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid;
}

.btn-login {
  background: white;
  border-color: white;
  color: var(--accent);
  font-weight: 600;
}

.btn-login:hover {
  background: rgba(255,255,255,0.9);
}

.btn-add-movie {
  background: var(--warning);
  border-color: var(--warning);
  color: #000;
  font-weight: 600;
}

.btn-add-movie:hover {
  background: #e6970f;
  border-color: #e6970f;
}

.btn-logout {
  background: transparent;
  border-color: rgba(255,255,255,0.5);
  color: white;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
}

/* Wyszukiwarka w headerze */
.header-search {
  position: relative;
  width: 100%;
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-secondary);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 5;
}

.search-clear-btn:hover {
  background: var(--danger);
}

#search-input {
  width: 100%;
  padding: 10px 40px 10px 18px;
  font-size: 0.95rem;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 25px;
  color: var(--text-primary);
  outline: none;
  transition: background 0.2s, box-shadow 0.2s;
}

#search-input:focus {
  background: white;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

#search-input::placeholder {
  color: var(--text-secondary);
}

/* Pasek filtrów i statystyk */
.filter-stats-bar {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.filter-stats-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.filter-nav {
  display: flex;
  gap: 10px;
}

.filter-nav-mobile {
  display: none;
  gap: 8px;
}

.filter-nav-mobile button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.filter-nav-mobile button:hover {
  background: rgba(76, 175, 80, 0.1);
}

.filter-nav-mobile button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-nav button {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-nav button:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}

.filter-nav button.active {
  background: white;
  border-color: white;
  color: var(--accent);
  font-weight: 600;
}

/* Dropdown wyników */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 8px;
  max-height: 500px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 50;
}

.search-dropdown.visible {
  display: block;
}

.dropdown-section {
  padding: 10px 0;
}

.dropdown-section:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.dropdown-section-title {
  padding: 8px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: 600;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
}

.dropdown-poster-link {
  cursor: pointer;
  flex-shrink: 0;
}

.dropdown-poster-link:hover {
  opacity: 0.85;
}

.dropdown-poster {
  width: 45px;
  height: 67px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.dropdown-poster.no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.dropdown-info {
  flex: 1;
  min-width: 0;
  text-align: left;
  cursor: pointer;
}

.dropdown-info:hover .dropdown-title {
  color: var(--accent);
}

.dropdown-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-title-en {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dropdown-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.dropdown-badge:hover {
  opacity: 0.8;
}

.badge-owned {
  background: var(--success-light);
  color: var(--success);
}

.badge-wanted {
  background: var(--warning-light);
  color: #997404;
}

.dropdown-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dropdown-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: opacity 0.2s;
  font-weight: 500;
}

.dropdown-actions button:hover {
  opacity: 0.85;
}

.dropdown-action-group {
  display: flex;
  gap: 4px;
}

.btn-add-format {
  background: var(--success);
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-format:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.btn-add-format.btn-bluray {
  background: #0055a4;
}

.format-icon {
  height: 16px;
  width: auto;
  filter: brightness(0) invert(1);
}

.btn-add-owned {
  background: var(--success);
  color: white;
}

.btn-add-wanted {
  background: var(--warning);
  color: #000;
}

/* Toolbar - widok i akcje */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-secondary);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  min-width: 150px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.year-filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-year-input {
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 100px;
}

.filter-year-input:focus {
  outline: none;
  border-color: var(--accent);
}

.year-clear-btn {
  position: absolute;
  right: 6px;
  background: var(--text-secondary);
  color: white;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.year-clear-btn:hover {
  background: var(--danger);
}

.btn-clear-filters {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-filters:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle button {
  background: var(--bg-secondary);
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.view-toggle button:not(:last-child) {
  border-right: 1px solid var(--border);
}

.view-toggle button.active {
  background: var(--accent);
  color: white;
}

.view-toggle button:hover:not(.active) {
  background: var(--bg-tertiary);
}

.filter-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 400px;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Bulk actions */
.bulk-actions {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  margin-bottom: 15px;
}

.bulk-actions.visible {
  display: flex;
}

.bulk-actions .selected-count {
  font-weight: 600;
}

.bulk-actions button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.bulk-actions button:hover {
  background: rgba(255,255,255,0.3);
}

.bulk-actions button.btn-bulk-delete {
  background: var(--danger);
}

/* Główna sekcja */
main {
  padding: 20px 0 20px;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

main.container {
  max-width: 1600px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Wrapper dla scrollowalnej listy */
.movies-grid-wrapper {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.section-title {
  font-size: 1.3rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .count {
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Siatka filmów - kafelki */
.movies-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: min-content;
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  padding-right: 10px;
  padding-bottom: 20px;
}

.movies-grid.active {
  display: grid;
}

.movie-card {
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: fit-content;
}

.movie-card:hover {
  box-shadow: var(--shadow-lg);
}

.movie-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.movie-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--accent);
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-tertiary);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.movie-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.movie-poster .no-poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}



.movie-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.movie-card-badges .movie-format-badge {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.movie-card-badges .movie-format-badge img {
  height: 14px;
  width: auto;
  max-width: 50px;
  position: static !important;
}

.badge-category-owned {
  background: var(--success);
  color: white;
}

.badge-category-wanted {
  background: var(--warning);
  color: #000;
}

.movie-card-info {
  padding: 12px;
}

.movie-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(198, 40, 40, 0.9);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
}

.movie-poster:hover .btn-card-delete {
  opacity: 1;
}

.btn-card-delete:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* Badge'e pod okładką */
.movie-card-badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  gap: 8px;
}

/* Widok listy */
.movies-list-container {
  display: none;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.movies-list-container.active {
  display: flex;
}

/* Empty state w wrapperze */
.movies-grid-wrapper .empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.movies-list-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.list-header-checkbox {
  width: 20px;
}

.list-header-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.list-header-poster {
  width: 60px;
}

.list-header-title {
  flex: 2;
  min-width: 200px;
}

.list-header-year {
  width: 80px;
}

.list-header-director {
  flex: 1;
  min-width: 150px;
}

.list-header-status {
  width: 100px;
}

.list-header-format {
  width: 80px;
}

.list-header-actions {
  width: 60px;
}

.movies-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

.movies-list .movie-list-item:first-child {
  border-radius: 0;
}

.movies-list .movie-list-item:last-child {
  border-radius: 0 0 8px 8px;
}

.movies-list .movie-list-item {
  border-radius: 0;
  border-top: none;
}

.movie-list-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.movie-list-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.movie-list-item.selected {
  border-color: var(--accent);
  background: rgba(13, 110, 253, 0.05);
}

.movie-list-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.movie-list-poster {
  width: 60px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.movie-list-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.movie-list-poster .no-poster {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

/* Stare - nieużywane, zostawione dla kompatybilności */
.movie-list-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 30px;
  cursor: pointer;
}

/* Kolumny w elemencie listy - dopasowane do nagłówka */
.movie-list-checkbox-cell {
  width: 20px;
  flex-shrink: 0;
}

.movie-list-title {
  flex: 2;
  min-width: 200px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-list-year {
  width: 80px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.movie-list-director {
  flex: 1;
  min-width: 150px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-list-status {
  width: 100px;
  flex-shrink: 0;
}

.movie-list-format {
  width: 80px;
  flex-shrink: 0;
}

.movie-list-actions {
  width: 60px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
}

.movie-list-badges {
  display: flex;
  gap: 6px;
}

.movie-list-badges .movie-badge {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.movie-list-badges .badge-format {
  padding: 4px 8px;
}

.movie-list-badges .badge-format-icon {
  height: 14px;
  filter: brightness(0) invert(1);
}

.movie-list-badges .badge-format-dvd {
  background: #d4a017;
}

.movie-list-badges .badge-format-bluray {
  background: #0055a4;
}

/* Badge format w widoku listy */
.movie-list-format .badge-format {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  max-width: 70px;
}

.movie-list-format .badge-format-dvd {
  background: #d4a017;
}

.movie-list-format .badge-format-bluray {
  background: #0055a4;
}

.movie-list-format .badge-format-icon {
  height: 12px;
  width: auto;
  max-width: 50px;
  filter: brightness(0) invert(1);
}

.movie-list-format .badge-format-icon-dvd,
.movie-list-format .badge-format-icon-bluray {
  height: 12px;
  width: auto;
  max-width: 50px;
}

.movie-list-actions {
  display: flex;
  gap: 8px;
}

.btn-list-delete {
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.movie-list-item:hover .btn-list-delete {
  opacity: 1;
}

.btn-list-delete:hover {
  background: var(--danger);
  color: white;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.2rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

/* Formularz */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.form-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* TMDB search w formularzu */
.tmdb-search-row {
  display: flex;
  gap: 10px;
}

.tmdb-search-row input {
  flex: 1;
}

.btn-tmdb-search {
  background: #01b4e4;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-tmdb-search:hover {
  opacity: 0.9;
}

/* Podgląd filmu */
.movie-preview {
  display: flex;
  gap: 20px;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 20px;
}

.movie-preview img {
  width: 100px;
  border-radius: 6px;
}

.movie-preview-info h3 {
  margin-bottom: 8px;
}

.movie-preview-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Przyciski */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #bb2d3b;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Szczegóły filmu */
.movie-details {
  display: flex;
  gap: 30px;
}

.movie-details-poster {
  width: 200px;
  flex-shrink: 0;
}

.movie-details-poster img {
  width: 100%;
  border-radius: 8px;
}

.movie-details-info {
  flex: 1;
}

.movie-details-info h2 {
  margin-bottom: 5px;
}

.movie-details-info .original-title {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 15px;
}

.movie-details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.movie-details-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.movie-details-plot {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.movie-details-badges {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.movie-details-badges .badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Statystyki */
.stats-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.stat-item {
  background: rgba(255,255,255,0.15);
  padding: 8px 16px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: white;
  color: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-export:hover {
  background: rgba(255,255,255,0.9);
  transform: translateY(-1px);
}

.export-icon {
  font-size: 1rem;
}

/* TMDB Results */
.tmdb-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 5px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow);
}

.tmdb-result-item {
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.tmdb-result-item:last-child {
  border-bottom: none;
}

.tmdb-result-item:hover {
  background: var(--bg-tertiary);
}

.tmdb-result-item img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.tmdb-result-info {
  flex: 1;
}

.tmdb-result-title {
  font-weight: 600;
}

.tmdb-result-year {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 15px 20px;
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Footer - TMDB Attribution */
footer {
  background: var(--header-bg);
  border-top: none;
  padding: 20px 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  text-align: center;
}

.tmdb-logo {
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.footer-text {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
}

.footer-text a {
  color: white;
  text-decoration: underline;
}

.footer-text a:hover {
  opacity: 0.8;
}

/* Confirm dialog */
.confirm-dialog {
  text-align: center;
  padding: 20px;
}

.confirm-dialog p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.confirm-dialog .modal-actions {
  justify-content: center;
}

/* Responsive - 1160px */
@media (max-width: 1160px) {
  .header-main {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .logo {
    flex-shrink: 0;
  }

  .header-center {
    flex: 1;
    min-width: 0;
  }

  .auth-section {
    flex-shrink: 0;
  }

  .logo img {
    height: 80px;
  }

  .header-filters {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .filter-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stats-bar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .toolbar-left {
    flex-wrap: wrap;
  }

  .filter-input {
    min-width: 200px;
  }
}

/* Responsive - 900px */
@media (max-width: 900px) {
  .header-main {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  .logo {
    flex-shrink: 0;
  }

  .header-center {
    flex: 1;
    min-width: 0;
  }

  .auth-section {
    flex-shrink: 0;
    flex-direction: column;
    gap: 5px;
  }

  .logo img {
    height: 60px;
  }

  .stat-item {
    padding: 6px 12px;
  }

  .stat-number {
    font-size: 1rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .filter-nav button {
    padding: 6px 14px;
    font-size: 0.85rem;
  }

  /* Lista filmów - ukryj niektóre kolumny */
  .list-header-director,
  .movie-list-director,
  .list-header-format,
  .movie-list-format {
    display: none;
  }

  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Responsive - 768px */
@media (max-width: 768px) {
  header .container {
    padding: 0 15px;
  }

  .header-main {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .logo {
    flex-shrink: 0;
  }

  .logo img {
    height: 70px;
  }

  .header-center {
    flex: 1;
    min-width: 0;
  }

  .auth-section {
    flex-shrink: 0;
    flex-direction: column;
    gap: 4px;
  }

  .auth-section button {
    min-width: 90px;
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .header-filters {
    display: none;
  }

  .filter-nav-mobile {
    display: flex;
  }

  .stats-bar {
    display: none;
  }

  /* Search dropdown - szersza niż input */
  .header-search {
    position: static;
  }

  .search-dropdown {
    position: fixed;
    left: 10px;
    right: 10px;
    top: auto;
    width: auto;
    max-height: 70vh;
  }

  .dropdown-actions {
    flex-direction: column;
    gap: 6px;
  }

  .dropdown-action-group {
    display: flex;
    gap: 6px;
  }

  .btn-add-wanted {
    width: 100%;
  }

  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }

  .movie-details {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .movie-details-poster {
    width: 150px;
  }

  .modal {
    margin: 10px;
    max-height: 95vh;
  }

  /* Toolbar - wszystko w jednej linii */
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    gap: 8px;
  }

  .toolbar-left {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }

  .section-title {
    white-space: nowrap;
    font-size: 0.9rem;
  }

  .toolbar-right {
    flex-shrink: 0;
  }

  .filter-input {
    min-width: 150px;
    flex: 1;
  }

  .filter-select {
    min-width: 100px;
    padding: 6px 8px;
    font-size: 0.85rem;
  }

  .filter-year-input {
    width: 70px;
    padding: 6px 25px 6px 8px;
  }

  .view-toggle button {
    padding: 6px 10px;
  }

  /* Sekcja tytułu ze statystykami inline */
  .section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
  }

  /* Lista filmów - prostsza wersja */
  .movies-list-header {
    display: none;
  }

  .movie-list-item {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 15px;
  }

  .movie-list-checkbox-cell {
    order: 1;
  }

  .movie-list-poster {
    order: 2;
    width: 50px;
    height: 75px;
  }

  .movie-list-title {
    order: 3;
    flex: 1;
    min-width: 150px;
  }

  .movie-list-year {
    order: 4;
    width: auto;
  }

  .movie-list-status {
    order: 5;
    width: auto;
  }

  .movie-list-actions {
    order: 6;
    width: auto;
  }

  .bulk-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .bulk-actions button {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

/* Responsive - 480px (telefony) */
@media (max-width: 480px) {
  header {
    padding: 10px 0;
  }

  .container {
    padding: 0 10px;
  }

  .header-main {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
  }

  .logo {
    flex-shrink: 0;
  }

  .logo img {
    height: 50px;
  }

  .header-center {
    flex: 1;
    min-width: 0;
  }

  .auth-section {
    flex-shrink: 0;
    flex-direction: column;
    gap: 3px;
  }

  .auth-section button {
    padding: 4px 8px;
    font-size: 0.7rem;
    min-width: 70px;
  }

  #search-input {
    padding: 8px 35px 8px 12px;
    font-size: 0.9rem;
  }

  /* Mobile filter nav */
  .filter-nav-mobile button {
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  .section-title {
    font-size: 0.8rem;
  }

  /* Search dropdown - 96% szerokości */
  .search-dropdown {
    left: 2%;
    right: 2%;
  }

  .btn-export .export-icon {
    display: none;
  }

  /* Toolbar - dwie linie */
  .toolbar {
    flex-wrap: wrap;
    padding: 8px;
    gap: 8px;
  }

  .toolbar-left {
    width: 100%;
    gap: 6px;
  }

  .toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .toolbar-right {
    flex-shrink: 0;
  }

  .filter-input {
    display: none;
  }

  .filter-select {
    min-width: 80px;
    padding: 5px 6px;
    font-size: 0.8rem;
  }

  .filter-year-input {
    width: 55px;
    padding: 5px 20px 5px 6px;
    font-size: 0.8rem;
  }

  .view-toggle button {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .movies-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .movie-card-info {
    padding: 8px;
  }

  .movie-card-title {
    font-size: 0.85rem;
  }

  .movie-card-meta {
    font-size: 0.7rem;
  }

  .movie-card-badges {
    padding: 6px 8px;
  }

  .movie-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  main {
    padding: 10px 0;
  }

  .section-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .section-title .count {
    font-size: 0.75rem;
    padding: 2px 8px;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-header {
    padding: 15px;
  }

  .dropdown-item {
    padding: 10px 12px;
  }

  .dropdown-actions {
    flex-direction: column;
    gap: 4px;
  }

  .btn-add-wanted {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .toast {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  footer {
    padding: 15px 0;
  }

  .footer-text {
    font-size: 0.75rem;
  }

  .tmdb-logo {
    height: 15px;
  }

  /* Bulk actions kompaktowe */
  .bulk-actions {
    padding: 8px;
    gap: 5px;
  }

  .bulk-actions button {
    padding: 5px 8px;
    font-size: 0.75rem;
  }
}
