/* Modern Dashboard Theme Styles */

/* ===== Base Styles ===== */
/* Body styles now handled by Tailwind classes in base.html */

/* Separator arrow (U+279C) in the "{sender} -> {receiver}" lines across the
 * email surfaces -- the list rows, the thread message headers, and the
 * reservation correspondence panel. The glyph sits high and heavy on the text
 * baseline compared to the label either side of it, so it reads as
 * un-centered at the 12px those lines use: nudge it down and take the weight
 * off. The em-relative values keep it correct if the line's font-size changes.
 * Global (not two_pane.css) because the reservation detail page uses it too. */
.arrow-sep {
    display: inline-block;
    font-size: 0.9em;
    line-height: 1;
    transform: translateY(0.08em);
    opacity: 0.65;
}

/* OWA-style unread accent bar for an individual message card (#1033),
 * shared by partials/staff_thread_message.html, contractor_thread_message.html
 * and reservation_correspondence.html -- all three render the same
 * .email-thread-message-card markup. Global (not two_pane.css) because the
 * reservation detail page renders this card without loading the two-pane
 * bundle. The message's own read state usually IS true by the time the
 * staff/contractor thread pane renders (mark-read runs before the response
 * is built), but the reservation page fetches its correspondence BEFORE
 * marking it read, so an unread message card genuinely shows up there.
 *
 * data-unread carries the string "true"/"false" here rather than being
 * present/absent like .tp-row's -- email_thread_reading.js also reads it
 * (as msgEl.dataset.unread === 'true') to decide which messages start
 * expanded -- so the selectors below match on the value, not just presence.
 * The border-left width is reserved for both states (only the color toggles)
 * so a message can't shift if its read state ever differs from the common
 * case. */
.email-thread-message-card {
    border-left-width: 4px;
    border-left-color: transparent;
}

.email-thread-message[data-unread="true"] .email-thread-message-card {
    border-left-color: #a855f7; /* purple-500, same accent as .tp-row's unread marker */
}

/* The one-line summary shown while a message is collapsed (#915) reads a
 * touch brighter while its message is still unread, echoing the accent bar. */
.email-thread-message[data-unread="true"] .email-thread-message-snippet {
    color: #d1d5db; /* gray-300 */
}

/* Typography for rendered inbound/outbound HTML email bodies (#1037),
 * shared by staff_thread_message.html, contractor_thread_message.html and
 * reservation_correspondence.html -- the same three surfaces that share
 * .email-thread-message-card above -- via the .email-body wrapper each of
 * them puts around msg.html_body. The "prose prose-invert prose-sm" classes
 * on that wrapper are inert: @tailwindcss/typography isn't installed (kept
 * out deliberately, see tailwind.config.js), so nothing actually implements
 * `.prose`. Meanwhile Tailwind Preflight zeroes margin on p/blockquote/
 * h1-h6/hr/pre and strips list markers/padding from ul/ol (see
 * dashboard/static/css/dist/main.css), so every paragraph/list/heading
 * boundary in a sender's own HTML collapses to a zero-gap wall of text --
 * this is what made an Outlook reply's one unstyled line of new content
 * unreadably fused to the quoted history beneath it. A small hand-written
 * block instead of the plugin keeps the bundle lean. */
.email-body p,
.email-body ul,
.email-body ol,
.email-body blockquote,
.email-body h1,
.email-body h2,
.email-body h3,
.email-body h4,
.email-body h5,
.email-body h6,
.email-body pre {
    margin: 0 0 1em;
}

.email-body h1,
.email-body h2,
.email-body h3 {
    font-size: 1.15em;
    font-weight: 600;
}

.email-body h4,
.email-body h5,
.email-body h6 {
    font-size: 1em;
    font-weight: 600;
}

.email-body ul {
    list-style: disc;
    padding-left: 1.5em;
}

.email-body ol {
    list-style: decimal;
    padding-left: 1.5em;
}

.email-body li {
    margin-bottom: 0.25em;
}

.email-body blockquote {
    padding-left: 0.75em;
    border-left: 3px solid #4b5563; /* gray-600 */
    color: #9ca3af; /* gray-400 -- dims quoted text a shade below the gray-300 body text */
}

/* Outlook's own <hr style="display:inline-block;width:98%"> loses its style
 * attribute to sanitization (api/app/services/mime_parser.py strips `style`
 * by design) and renders full-width with zero margin without this -- give it
 * real vertical breathing room and a border color that reads against the
 * dark card surface instead of Preflight's near-invisible browser default. */
.email-body hr {
    margin: 1em 0;
    border: none;
    border-top: 1px solid #4b5563; /* gray-600 */
}

.email-body > :last-child {
    margin-bottom: 0;
}

/* Smooth transitions for interactive elements */
a, button, input, textarea, select {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Better focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgb(126 34 206); /* purple-700 */
    outline-offset: 2px;
}

/* Card hover effects - used in components */
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.2), 0 4px 6px -2px rgba(168, 85, 247, 0.1);
    border-color: rgb(107 114 128); /* border-gray-500 on hover */
}



/* ===== Button Styles ===== */
.btn {
    @apply inline-flex items-center justify-center px-4 py-2 text-sm font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.btn-primary {
    @apply bg-purple-700 text-white hover:bg-purple-600 focus:ring-purple-600;
}

.btn-secondary {
    @apply bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 focus:ring-gray-500;
}

.btn-success {
    @apply bg-green-600 text-white hover:bg-green-700 focus:ring-green-500;
}

.btn-danger {
    @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.btn-warning {
    @apply bg-amber-600 text-white hover:bg-amber-700 focus:ring-amber-500;
}

/* Button sizes */
.btn-sm {
    @apply px-3 py-1.5 text-xs;
}

.btn-lg {
    @apply px-6 py-3 text-base;
}

/* ===== Form Styles ===== */
.form-group {
    @apply mb-4;
}

.form-label {
    @apply block text-sm font-medium text-gray-700 mb-1;
}

.form-input {
    @apply block w-full px-3 py-2 border border-gray-600 rounded-lg shadow-sm text-sm 
           focus:ring-purple-600 focus:border-purple-600 bg-gray-700 text-white;
}

.form-input:disabled {
    @apply bg-gray-100 cursor-not-allowed;
}

.form-textarea {
    @apply block w-full px-3 py-2 border border-gray-600 rounded-lg shadow-sm text-sm 
           focus:ring-purple-600 focus:border-purple-600 bg-gray-700 text-white;
}

.form-select {
    @apply block w-full px-3 py-2 border border-gray-600 rounded-lg shadow-sm text-sm 
           focus:ring-purple-600 focus:border-purple-600 bg-gray-700 text-white;
}

.form-checkbox {
    @apply h-4 w-4 text-purple-600 border-gray-600 rounded focus:ring-purple-600;
}

.form-radio {
    @apply h-4 w-4 text-purple-600 border-gray-600 focus:ring-purple-600;
}

/* ===== Badge Styles ===== */
.badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.badge-primary {
    @apply bg-purple-700/25 text-purple-300;
}

.badge-success {
    @apply bg-green-100 text-green-800;
}

.badge-warning {
    @apply bg-amber-100 text-amber-800;
}

.badge-danger {
    @apply bg-red-100 text-red-800;
}

.badge-info {
    @apply bg-cyan-100 text-cyan-800;
}

.badge-gray {
    @apply bg-gray-100 text-gray-800;
}

/* ===== Table Styles ===== */
.data-table {
    @apply bg-gray-800 rounded-lg shadow-sm border border-gray-700 overflow-hidden;
}

.data-table thead {
    @apply bg-gray-50;
}

.data-table th {
    @apply px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
}

.data-table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

.data-table tbody tr {
    @apply border-t border-gray-200;
}

.data-table tbody tr:hover {
    @apply bg-gray-50;
}

/* ===== Activity/Timeline Styles ===== */
.activity-feed {
    @apply space-y-4;
}

.activity-item {
    @apply flex items-start;
}

.activity-indicator {
    @apply flex-shrink-0 w-2 h-2 rounded-full mt-2;
}

.activity-content {
    @apply ml-4 flex-1;
}

.activity-title {
    @apply text-sm font-medium text-gray-900;
}

.activity-time {
    @apply text-sm text-gray-500;
}

/* ===== Alert Styles ===== */
.alert {
    @apply p-4 rounded-lg;
}

.alert-info {
    @apply bg-blue-50 text-blue-800 border border-blue-200;
}

.alert-success {
    @apply bg-green-50 text-green-800 border border-green-200;
}

.alert-warning {
    @apply bg-amber-50 text-amber-800 border border-amber-200;
}

.alert-danger {
    @apply bg-red-50 text-red-800 border border-red-200;
}

/* ===== Loading States ===== */
.loading {
    @apply opacity-50 pointer-events-none;
}

.spinner {
    @apply animate-spin h-5 w-5 text-blue-600;
}

/* ===== Masonry Gallery Layout ===== */
.masonry-gallery {
    column-count: 2;
    column-gap: 1rem;
}

@media (min-width: 768px) {
    .masonry-gallery {
        column-count: 3;
    }
}

@media (min-width: 1024px) {
    .masonry-gallery {
        column-count: 4;
    }
}

.masonry-gallery > div {
    @apply mb-4;
    break-inside: avoid;
    display: inline-block;
    width: 100%;
}

.masonry-gallery img {
    @apply rounded-t-lg block w-full h-auto;
}

.masonry-gallery .group:hover .opacity-0 {
    opacity: 1;
}

/* Success glow effect - temporary green outline */
.field-success {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5), 0 0 8px rgba(34, 197, 94, 0.3) !important;
    border-color: rgb(34, 197, 94) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Error glow effect - persistent red outline */
.field-error {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5), 0 0 8px rgba(239, 68, 68, 0.3) !important;
    border-color: rgb(239, 68, 68) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Loading state - subtle blue glow */
.field-loading {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 6px rgba(59, 130, 246, 0.2) !important;
    border-color: rgb(59, 130, 246) !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Dark mode adjustments */
.dark .field-success {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6), 0 0 10px rgba(34, 197, 94, 0.4) !important;
}

.dark .field-error {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.6), 0 0 10px rgba(239, 68, 68, 0.4) !important;
}

.dark .field-loading {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4), 0 0 8px rgba(59, 130, 246, 0.3) !important;
}

/* ===== Sidebar Specific Styles ===== */
.sidebar-link {
    @apply flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors;
}

.sidebar-link:hover {
    @apply bg-gray-700 text-white;
}

.sidebar-link.active {
    @apply bg-purple-700 text-white border-l-4 border-purple-600;
}

.sidebar-icon {
    @apply w-5 h-5 mr-3;
}

/* ===== Page Headers ===== */
.page-header {
    @apply mb-6;
}

.page-title {
    @apply text-2xl font-bold text-gray-900;
}

.page-subtitle {
    @apply mt-1 text-sm text-gray-500;
}

/* ===== Utility Classes ===== */
.text-primary {
    @apply text-purple-300;
}

.text-success {
    @apply text-green-600;
}

.text-warning {
    @apply text-amber-600;
}

.text-danger {
    @apply text-red-600;
}

.bg-primary {
    @apply bg-purple-700;
}

.bg-success {
    @apply bg-green-600;
}

.bg-warning {
    @apply bg-amber-600;
}

.bg-danger {
    @apply bg-red-600;
}

/* ===== Responsive Utilities ===== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ===== Animation Classes ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

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

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100;
}

::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-500;
}

/* ===== Print Styles ===== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* ===== Sidebar Specific Styles ===== */
.sidebar-link {
    @apply flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors;
}

.sidebar-link:hover {
    @apply bg-gray-700 text-white;
}

.sidebar-link.active {
    @apply bg-purple-700 text-white border-l-4 border-purple-600;
}

.sidebar-icon {
    @apply w-5 h-5 mr-3;
}

/* ===== Page Headers ===== */
.page-header {
    @apply mb-6;
}

.page-title {
    @apply text-2xl font-bold text-gray-900;
}

.page-subtitle {
    @apply mt-1 text-sm text-gray-500;
}

/* ===== Utility Classes ===== */
.text-primary {
    @apply text-purple-300;
}

.text-success {
    @apply text-green-600;
}

.text-warning {
    @apply text-amber-600;
}

.text-danger {
    @apply text-red-600;
}

.bg-primary {
    @apply bg-purple-700;
}

.bg-success {
    @apply bg-green-600;
}

.bg-warning {
    @apply bg-amber-600;
}

.bg-danger {
    @apply bg-red-600;
}

/* ===== Responsive Utilities ===== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ===== Animation Classes ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

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

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100;
}

::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-500;
}

/* ===== Print Styles ===== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}