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

:root {
  --primary-color: #3498db;
  --secondary-color: #2ecc71;
  --accent-color: #9b59b6;
  --background-color: #f5f5f5;
  --card-background: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --text-color: #333333;
  --text-color-light: #666666;
  --border-color: #dddddd;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dark-mode {
  --primary-color: #3498db;
  --secondary-color: #2ecc71;
  --accent-color: #9b59b6;
  --background-color: #1a1a1a;
  --card-background: #2d2d2d;
  --card-bg: #2d2d2d;
  --input-bg: #2d2d2d;
  --text-color: #f0f0f0;
  --text-color-light: #aaaaaa;
  --border-color: #444444;
  --shadow: 0 2px 10px rgba(0,0,0,0.3);
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
}

.nav-links li {
  margin-left: 1.5rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.nav-links a:hover, .nav-links a.active {
  background-color: var(--primary-color);
  color: white;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  background-color: var(--card-background);
  color: var(--text-color);
}

header h1 {
    font-size: 2em;
    color: var(--text-color);
}

/* Controls section */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.selection-info {
  font-weight: 500;
  margin-right: 20px;
  align-self: center;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
    min-width: 300px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
}

.filter-group select,
.filter-group input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9em;
    background-color: var(--card-background);
    color: var(--text-color);
}

.form-control {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--card-background);
  color: var(--text-color);
}

#apply-filters {
    align-self: flex-end;
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#apply-filters:hover {
    background-color: #0056b3;
}

.view-options {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.view-options button {
    padding: 8px 15px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

.view-options button.active {
    background-color: var(--primary-color);
    color: white;
}

.action-buttons {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  margin-left: 0.5rem;
  transition: opacity 0.3s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

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

.bulk-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-left: auto;
}

.bulk-actions button {
    padding: 8px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.bulk-actions button:nth-child(3) {
    background-color: #dc3545;
}

.bulk-actions button:hover {
    opacity: 0.9;
}

#selected-count {
    align-self: center;
    font-weight: bold;
    margin-left: 10px;
}

#selectedCount {
    font-weight: bold;
    margin-right: 5px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 10px;
}

.pagination button {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

#page-info, #page-info-bottom {
    font-weight: bold;
}


.set-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

/* Image grid/list - override with 6 columns for consistency */
.image-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr); /* Exactly 6 columns */
    gap: 10px; /* Reduced gap to accommodate more content */
    margin: 20px 0;
}

.image-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.image-item {
    position: relative;
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.image-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.image-item.selected {
    border: 3px solid var(--primary-color);
}

.image-checkbox {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 10;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Note: image-thumbnail styles are defined in browse/styles.css for proper aspect ratio handling */

.image-details {
    padding: 10px;
}

.image-details h4 {
    font-size: 0.9em;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #666;
}

.set-card {
  background-color: var(--card-background);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  cursor: pointer;
}

.set-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.set-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.set-card .set-info {
  padding: 0.75rem;
  text-align: center;
}

.set-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.use-clothing-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.8;
}

.use-clothing-btn.selected {
  background-color: #f39c12;
  opacity: 1;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--card-background);
    margin: 0 auto; /* Further reduced margin */
    padding: 50px; /* Reduced padding to maximize image space */
    border-radius: 8px;
    width: 75%; /* Increased width */
    max-width: 650px; /* Changed from 900px to 700px */
    position: relative;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%); /* Center the modal */
    color: var(--text-color);
    max-height: 90vh; /* Increased to use more of the viewport */
    overflow: hidden; /* Hide overflow since image will be contained differently */
}

.modal-content img {
    max-width: 100%;
    height: auto;
}

.set-modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    position: relative;
    color: var(--text-color);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    color: var(--text-color);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.modal-header p {
    margin: 5px 0;
    font-size: 0.9em;
}

.image-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--text-color);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover {
    color: #ccc;
}

#prev-image, #next-image {
    background: transparent;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 10px;
    margin: 0 10px;
}

#prev-image:hover, #next-image:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 50%;
}

/* Hide the direct modal image when it's wrapped in image-wrapper */
#image-modal .modal-content img:not(.image-thumbnail) {
    display: none;
}

/* The actual image will be inside the image-wrapper */
#modal-image {
    width: 100%;
    height: auto;
    max-width: 100%; /* Account for side margins */
    max-height: calc(95vh - 20px); /* Account for header/footer areas */
    margin: 10px auto; /* 10px margin around the image */
    display: block;
    border-radius: 4px;
    object-fit: contain; /* Maintain aspect ratio without stretching */
}

/* Updated modal content layout to properly arrange header and image */
#image-modal .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: auto; /* Changed from 85vh to auto for better fit */
    max-height: 90vh; /* Keep max-height to prevent overflow */
    padding: 10px;
    position: relative;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
}

/* Responsive design */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group {
        min-width: auto;
    }

    .view-options, .bulk-actions, .action-buttons {
        width: 100%;
        justify-content: center;
    }

    .action-buttons {
        margin-top: 10px;
    }

    .bulk-actions {
        margin-left: 0;
    }

    .image-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on mobile */
    }

    nav {
        flex-direction: column;
        padding: 1rem;
    }

    .nav-links {
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links li {
        margin: 0.5rem;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
        justify-content: space-between;
    }

            .btn {
            margin: 0 0.25rem;
        flex: 1;
    }
}

/* On larger screens, ensure 6 columns for image grid */
@media (min-width: 769px) {
    .image-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}


