/*
 * 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.
 */

/* ===== Base Styles ===== */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    color: #374151;
    background-color: #f9fafb;
}

/* Default scrolling behavior for all pages except listings */
body:not(.listings-page) {
    overflow-y: auto;
}

body.listings-page {
    overflow: hidden;
}

main {
    position: relative;
}

/* Non-listings pages should scroll normally */
main:not(.listings-layout) {
    height: auto;
    overflow: visible;
}

/* Standard content container */
.content-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
}

/* ===== Navigation ===== */
nav.main-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: #0d1b44;
    color: white;
}

/* ===== Flash Messages ===== */
.flash-message {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
}

.flash-notice {
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.flash-alert {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ===== Standard Tables (non-fixed) ===== */
.standard-table-container {
    overflow-x: auto;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.standard-table {
    width: 100%;
    border-collapse: collapse;
}

.standard-table th {
    background-color: #f9fafb;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    color: #6b7280;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.standard-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #e5e7eb;
}

.standard-table tbody tr:hover {
    background-color: #f9fafb;
}

/* ===== Form Elements ===== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    width: 100%;
}

input:focus,
select:focus {
    outline: none;
    border-color: #0176ff;
    box-shadow: 0 0 0 2px rgba(1, 118, 255, 0.2);
}

button,
.button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.button-primary {
    background-color: #0176ff;
    color: white;
    border: 1px solid transparent;
}

.button-primary:hover {
    background-color: #0d1b44;
}

.button-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.button-secondary:hover {
    background-color: #f9fafb;
}

/* ===== Cards ===== */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.pagination li {
    margin: 0 0.25rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #4b5563;
}

.pagination a:hover {
    background-color: #f9fafb;
}

.pagination .current {
    background-color: #e6eaec;
    border-color: #0176ff;
    color: #0176ff;
}

/* ===== Utilities ===== */
.overflow-x-auto {
    overflow-x: auto;
}

.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.whitespace-normal {
    white-space: normal;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Tooltip Styles ===== */
[data-tooltip-target="content"] {
    display: none;
    z-index: 9999;
}

[data-tooltip-target="content"].tooltip-visible {
    display: block;
}

/* ===== Dark Mode Overrides ===== */
:is(.dark) body {
    color: #d1d5db;
    background-color: #111827;
}

:is(.dark) .flash-message {
    background-color: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

:is(.dark) .flash-notice {
    background-color: #1e3a8a;
    border-color: #3730a3;
    color: #dbeafe;
}

:is(.dark) .flash-alert {
    background-color: #7f1d1d;
    border-color: #991b1b;
    color: #fee2e2;
}

:is(.dark) .card {
    background-color: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

:is(.dark) .card-header,
:is(.dark) .card-footer {
    border-color: #374151;
}

:is(.dark) .standard-table th {
    background-color: #111827;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
}

:is(.dark) .standard-table td {
    color: #d1d5db;
    border-bottom: 1px solid #374151;
}

:is(.dark) .standard-table tbody tr:hover {
    background-color: #1f2937;
}

:is(.dark) input[type="text"],
:is(.dark) input[type="email"],
:is(.dark) input[type="password"],
:is(.dark) input[type="search"],
:is(.dark) select {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

:is(.dark) input::placeholder,
:is(.dark) select::placeholder {
    color: #9ca3af;
}

:is(.dark) .button-secondary {
    background-color: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

:is(.dark) .button-secondary:hover {
    background-color: #4b5563;
}

:is(.dark) .pagination a,
:is(.dark) .pagination span {
    border-color: #374151;
    color: #d1d5db;
}

:is(.dark) .pagination a:hover {
    background-color: #1f2937;
}

:is(.dark) .pagination .current {
    background-color: #0d1b44;
    border-color: #0176ff;
    color: #0176ff;
}

/* Generic color overrides for elements without explicit dark classes */
:is(.dark) .bg-white {
    background-color: #1f2937 !important;
}

:is(.dark) .bg-gray-50 {
    background-color: #111827 !important;
}

:is(.dark) .border-gray-300 {
    border-color: #4b5563 !important;
}

:is(.dark) .border-gray-200 {
    border-color: #374151 !important;
}

:is(.dark) .text-gray-900 {
    color: #f3f4f6 !important;
}

:is(.dark) .text-gray-700 {
    color: #d1d5db !important;
}

:is(.dark) .text-gray-600 {
    color: #9ca3af !important;
}

:is(.dark) .text-gray-500 {
    color: #6b7280 !important;
}
