/* Main styles for the orchestrator app */
* {
    box-sizing: border-box;
}

:root {
    --button-hover: #0056b3;
    --max-content-width: 1600px;
}
body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-bright);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-links a:hover {
    background-color: var(--button-hover);
}

.topNav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
}

.logo {
    text-decoration: none;
    color: inherit;
}

.logo:hover {
    text-decoration: none;
    color: inherit;
}

.logo h1 {
    margin: 0;
    color: var(--text-bright);
}

section .padded, main {
  margin: 1em;
  width: 100%;
  max-width: var(--max-content-width);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.search-container {
  margin-bottom: 2rem;
}

.search-container input {
  width: -moz-available;
  width: -webkit-fill-available;
  width: fill-available;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background-alt);
  color: var(--text-bright);
  font-size: 1rem;
}

.search-container input:focus {
  outline: none;
  border-color: var(--button-base);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--background);
    border-top: 1px solid var(--border);
}

.profile {
    color: var(--text-bright);
    text-decoration: none;
}

.profile:hover {
    color: var(--text-bright);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
  }
  
  .btn-primary {
    background-color: var(--button-base);
    color: white;
  }
  
  .btn-primary:hover {
    background-color: var(--button-hover);
    color: white;
  }
  
  .alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
  }
  
  .alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
  }
  
  .alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
  }

/* Global Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    max-width: 400px;
}

.notification {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.notification.error {
    border-left: 4px solid #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.notification.info {
    border-left: 4px solid #17a2b8;
    background: rgba(23, 162, 184, 0.1);
}

.notification.warning {
    border-left: 4px solid #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.notification-message {
    flex: 1;
    color: var(--text-bright);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    margin-left: 1rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: var(--text-bright);
}

/* Common Layout Classes */

/* List/Management Pages - Full width with max-content-width */
.list-page-container {
    padding: 2rem;
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    box-sizing: border-box;
}

.list-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.list-page-header h2 {
    color: var(--text-bright);
    margin: 0;
}

.list-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 250px);
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    --card-width: 250px;
    --gap-size: 1.5rem;
}

/* Module-specific grid sizes */
.list-page-grid.grid-small {
    grid-template-columns: repeat(auto-fill, 200px);
    --card-width: 200px;
}

.list-page-grid.grid-medium {
    grid-template-columns: repeat(auto-fill, 365px);
    --card-width: 365px;
}

.list-page-grid.grid-large {
    grid-template-columns: repeat(auto-fill, 400px);
    --card-width: 400px;
}

.list-page-card {
    background: var(--background-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
}

.list-page-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Ensure all module-specific card classes inherit common styles */
.accessory-card,
.train-card,
.function-card,
.product-card,
.accessory-type-card {
    background: var(--background-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
}

.accessory-card:hover,
.train-card:hover,
.function-card:hover,
.product-card:hover,
.accessory-type-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.list-page-card h3,
.accessory-card h3,
.train-card h3,
.function-card h3,
.product-card h3,
.accessory-type-card h3 {
    color: var(--text-bright);
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.list-page-card .card-category {
    color: var(--text-bright);
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-page-card .card-description {
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
}

.list-page-card .card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #545b62;
    border-radius: 4px;
}

.list-page-card .card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.no-items,
.no-accessories,
.no-trains,
.no-functions,
.no-products {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Form Pages - Fixed 800px width */
.form-page-container {
    max-width: 1024px;
    margin: 0 auto;
}

.form-page-container form {
    max-width: 1024px;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background-alt);
}

.form-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: var(--text-bright);
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-bright);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--button-base);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-group input[readonly] {
    background: var(--background-alt);
    color: var(--text-muted);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-actions {
    margin-top: 2rem;
    text-align: center;
}

/* Common Button Styles (already defined but ensuring consistency) */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    margin: 0 0.25rem;
}

.btn-primary {
    background-color: var(--button-base);
    color: white;
}

.btn-primary:hover {
    background-color: var(--button-hover);
    color: white;
}


.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    color: white;
}

/* Common Search Container */
.search-container {
    margin-bottom: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background-alt);
    color: var(--text-bright);
    font-size: 1rem;
    box-sizing: border-box;
}

.search-container input:focus {
    outline: none;
    border-color: var(--button-base);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .list-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .list-page-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .list-page-container,
    .form-page-container {
        padding: 1rem;
    }
    
    .list-page-grid,
    .list-page-grid.grid-small,
    .list-page-grid.grid-medium,
    .list-page-grid.grid-large {
        grid-template-columns: 1fr;
    }
}

/* Clickable Cards */
.clickable-card {
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.clickable-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.clickable-card:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Page header styles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0rem;
  gap: 1rem;
  padding: 0 1rem;
}

.page-header h1 {
  margin: 0;
  flex: 1;
}

.page-header .header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .page-header .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Filter container styles */
.filters-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.search-container {
  flex: 1;
}

.category-filter {
  min-width: 200px;
}

.category-filter select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background-alt);
  color: var(--text-bright);
  font-size: 1rem;
  box-sizing: border-box;
  height: 48px;
  line-height: 1.5;
}

.category-filter select:focus {
  outline: none;
  border-color: var(--button-base);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

@media (max-width: 768px) {
  .filters-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .category-filter {
    min-width: auto;
  }
}

/* Logout button styling to match nav links */
.logout-btn {
  background: none;
  border: none;
  color: var(--text-bright);
  text-decoration: none;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background-color: var(--button-hover);
}

/* Grid centering utility - see /public/js/grid-centering.js */