/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Custom Global Styles - Premium Design System */
:root {
    color-scheme: dark;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --secondary-bg: #111827;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #f9fafb;
}

body {
    background-color: var(--secondary-bg) !important;
    color: var(--text-primary) !important;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    color: var(--text-primary) !important;
}

label {
    color: #e5e7eb !important;
}

/* Glassmorphism Classes */
.card,
.navbar,
.alert-glass-success,
.alert-glass-danger {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

.card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 2rem;
}

.card:hover {
    transform: translateY(-5px);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-group-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #6b7280;
    margin: 1.5rem 0 0.75rem 0.5rem;
    font-weight: 700;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-link.active {
    background: var(--primary-gradient);
    color: white;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #6366f1 !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
    outline: none !important;
}

/* Ensure placeholder is visible but distinct */
.form-control::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Fix browser-native dropdowns (select and datalist) */
option {
    background-color: #1f2937 !important; /* Slightly lighter gray for better contrast in dark mode */
    color: var(--text-primary) !important;
}

/* Improve selection visibility for browsers that support it */
option:hover,
option:focus,
option:active,
option:checked {
    background-color: #6366f1 !important; /* Matches primary brand color */
    color: #ffffff !important;
}

/* Custom Book Search Dropdown */
.book-search-container {
    position: relative;
}

.book-results-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2100 !important; /* Extremely high z-index to avoid overlap */
    background-color: #1f2937;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--glass-shadow);
    display: none;
}

.book-results-list.show {
    display: block;
}

/* Ensure the table cell doesn't clip the dropdown */
.nested-fields {
    position: relative;
}

/* Fix Bootstrap table-responsive clipping */
.table-responsive {
    overflow: visible !important;
}

.book-result-item {
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.book-result-item:hover,
.book-result-item.selected {
    background-color: #6366f1 !important;
    color: #ffffff !important;
}

.book-result-item .stock-info {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-left: 8px;
}

optgroup {
    background-color: var(--secondary-bg) !important;
    color: #94a3b8 !important;
    /* Muted but visible color for the group labels */
    font-weight: 700;
    font-style: normal;
}

.table {
    color: #e5e7eb !important;
}

.form-label {
    color: #e5e7eb !important;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Force solid dark background for inputs in datatables to avoid any transparent overlay issues */
.table .form-control,
.table .form-select {
    background-color: var(--secondary-bg) !important;
    color: #ffffff !important;
}

.table .form-control:focus,
.table .form-select:focus {
    background-color: #1f2937 !important;
    color: #ffffff !important;
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }
}
/* Responsive Divider Utilities */
@media (min-width: 1200px) {
  .border-start-xl { border-left: 1px solid rgba(255,255,255,0.1) !important; }
  .border-end-xl { border-right: 1px solid rgba(255,255,255,0.1) !important; }
}
@media (min-width: 768px) {
  .border-start-md { border-left: 1px solid rgba(255,255,255,0.1) !important; }
}

.ls-1 { letter-spacing: 0.05rem; }
.stock-pill { transition: all 0.2s ease; }
.stock-pill:hover { transform: translateY(-1px); background: rgba(255,255,255,0.1) !important; }
