/**
 * Firefly MUD - Custom Theme Overrides
 * Extends Bootswatch Slate theme
 */

/* ================================
   CSS Custom Properties
   ================================ */
:root {
    --prom-bg-darker: #1a1a1a;
    --prom-bg-dark: #272b30;
    --prom-text-light: #e0e0e0;
    --prom-accent: #87ceeb;
}

/* ================================
   Button Icon Alignment
   ================================ */
.btn i.bi {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* ================================
   Global Styles
   ================================ */
body {
    font-family: 'Oxygen', 'Arial', sans-serif;
    min-height: 100vh;
}

/* ================================
   Background Utilities
   ================================ */
.bg-darker {
    background-color: var(--prom-bg-darker) !important;
}

/* ================================
   Navbar Brand Logo
   ================================ */
.brand-logo {
    font-family: 'Crimson Text', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ================================
   Scroll to Top Button
   ================================ */
.btn-scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.btn-scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.btn-scroll-top:hover {
    transform: translateY(-3px);
}

/* ================================
   Hero Section
   ================================ */
.hero-section {
    min-height: 70vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.6) 50%,
        rgba(39, 43, 48, 0.95) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.hero-content > * {
    width: 100%;
}

.hero-title {
    font-family: 'Crimson Text', serif;
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ================================
   Page Banner (Internal Pages)
   ================================ */
.page-banner {
    min-height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.page-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(39, 43, 48, 0.9) 100%
    );
}

.page-banner-content {
    position: relative;
    z-index: 1;
}

.page-banner-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-banner-content p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
}

.page-banner-content .breadcrumbs {
    margin-bottom: 0.75rem;
}

.page-banner-content .breadcrumbs a {
    color: rgba(255, 255, 255, 0.7);
}

.page-banner-content .breadcrumbs a:hover {
    color: #ffffff;
}

.page-banner-content .breadcrumbs li::before {
    color: rgba(255, 255, 255, 0.5);
}

/* ================================
   Feature Cards
   ================================ */

/* ================================
   Activity Items
   ================================ */
.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.activity-time {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ================================
   Status Indicator
   ================================ */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* ================================
   Tab Panels (visibility handled by layout.erb)
   ================================ */

/* ================================
   Form Overrides
   ================================ */
.form-control:focus,
.form-select:focus {
    border-color: var(--prom-accent);
    box-shadow: 0 0 0 0.25rem rgba(135, 206, 235, 0.25);
}

/* ================================
   Page Headers
   ================================ */
.page-header {
    font-family: 'Crimson Text', serif;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ================================
   Content Cards
   ================================ */
.content-card {
    background-color: rgba(42, 42, 42, 0.95);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1.5rem;
}

/* ================================
   Sidebar Styling
   ================================ */
.sidebar .card {
    margin-bottom: 1.5rem;
}

/* Breadcrumb styles are in layout.erb */

/* ================================
   Footer Links
   ================================ */
footer a:hover {
    color: #fff !important;
    text-decoration: underline;
}

/* ================================
   Emote & Roleplay Styling
   ================================ */

/* Spotlight emote - outdented block for characters with camera focus */
.spotlight-emote {
    margin-left: -1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--prom-accent, #87ceeb);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(135, 206, 235, 0.03);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-right: 0.5rem;
    border-radius: 0 4px 4px 0;
}

/* ================================
   Responsive Adjustments
   ================================ */
@media (max-width: 992px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .page-banner h1 {
        font-size: 1.75rem;
    }

    .btn-scroll-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* ================================
   Atmospheric Emits
   ================================ */
.atmospheric-emit {
    color: #8b8b8b;
    font-style: italic;
    font-size: 0.9em;
    padding: 4px 0;
    border-left: 2px solid #444;
    padding-left: 8px;
    margin: 4px 0;
    opacity: 0.85;
}

/* ================================
   Observation Panel - Exits
   ================================ */
.obs-exits {
    color: #b0b0b0;  /* Reset to standard text gray, not link cyan */
}

.obs-exit,
.obs-exit:link,
.obs-exit:visited {
    color: #b0b0b0 !important;  /* Explicitly set gray, not inherit from cyan parent */
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s, text-decoration 0.2s;
}

.obs-exit:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.obs-exit:active {
    color: inherit !important;
}

.obs-exit-locked {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted, #888);
}

.obs-exit-locked:hover {
    text-decoration: line-through;
}

.obs-exit sup {
    font-size: 0.65em;
    line-height: 1;
    opacity: 0.7;
    margin-left: 1px;
    vertical-align: super;
}

/* ================================
   Observation Panel - Quickmenu
   ================================ */
.obs-quickmenu {
    padding: 1rem;
    background: #000;
    border: 1px solid rgba(135, 206, 235, 0.4);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-8px);
    animation: quickmenuSlideIn 150ms ease-out forwards;
}

@keyframes quickmenuSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.obs-quickmenu.closing {
    animation: quickmenuSlideOut 100ms ease-out forwards;
}

@keyframes quickmenuSlideOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.obs-quickmenu-prompt {
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #87ceeb;
    font-size: 0.9rem;
}

.obs-quickmenu-options {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.obs-quickmenu-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 100ms ease-out;
}

.obs-quickmenu-option:hover {
    background: rgba(135, 206, 235, 0.08);
    border-color: rgba(135, 206, 235, 0.4);
}

.obs-quickmenu-option .obs-option-number {
    color: #87ceeb;
    font-family: monospace;
    font-weight: 600;
    min-width: 1.5em;
    font-size: 0.9em;
}

.obs-quickmenu-option .obs-option-label {
    flex: 1;
    color: #f0f0f0;
}

.obs-quickmenu-option .obs-option-desc {
    color: #666;
    font-size: 0.85em;
}

.obs-quickmenu-hint {
    margin-top: 0.75rem;
    font-size: 0.8em;
    color: #666;
    text-align: center;
}

/* ================================
   Observation Panel - Form
   ================================ */
.obs-form {
    padding: 1rem;
}

.obs-form-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.obs-form-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.obs-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.obs-form-field label {
    font-weight: 500;
    color: var(--text-primary);
}

.obs-form-field .obs-required {
    color: var(--error-color, #e53935);
    margin-left: 0.25em;
}

.obs-form-field input,
.obs-form-field textarea,
.obs-form-field select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.obs-form-field input:focus,
.obs-form-field textarea:focus,
.obs-form-field select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary-transparent, rgba(66, 133, 244, 0.2));
}

.obs-form-field textarea {
    min-height: 80px;
    resize: vertical;
}

.obs-form-field input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.obs-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.obs-form-submit {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.obs-form-submit:hover {
    background: var(--accent-primary-hover);
}

.obs-form-cancel {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.obs-form-cancel:hover {
    background: var(--bg-hover);
}

/* ================================
   Observation Panel - Character Display
   ================================ */

/* Name line: "Bob, a tall man" (combined name + short_desc) */
.obs-character-name-line {
    font-size: 1.15em;
    font-weight: 600;
    color: var(--prom-accent, #87ceeb);
    margin-bottom: 0.25rem;
}

/* Eyes/hair line: "He has brown eyes and blonde hair." */
.obs-character-eyes-hair {
    color: #c0c0c0;
    font-size: 0.95em;
    margin-bottom: 0.5rem;
}

/* Combined "is using" section */
.obs-using-section {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.obs-using-list {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}

.obs-using-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

.obs-using-held {
    color: #e0e0e0;
}

.obs-using-worn {
    color: #b0b0b0;
}

/* Separator between held and worn items */
.obs-using-separator {
    height: 0.5rem;
    border: none;
    margin: 0;
    padding: 0;
}

/* Character intro (body type, height) */
.obs-character-intro {
    color: #d0d0d0;
    font-size: 0.95em;
    margin-bottom: 0.25rem;
}

/* Character descriptions container */
.obs-character-descriptions {
    margin: 0.5rem 0;
    color: #c0c0c0;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Individual description text (now inline with separators) */
.obs-desc-text {
    /* Inline display to flow with separators */
}

/* Status display */
.obs-character-status {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
    margin-bottom: 0.25rem;
}

/* Roomtitle display */
.obs-character-roomtitle {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 0.25rem;
}

/* Thumbnail gallery */
.obs-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.obs-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.obs-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Portrait container with overlays */
.portrait-container {
    position: relative;
    float: left;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
}

.obs-profile-pic {
    max-width: 120px;
    max-height: 120px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid rgba(135, 206, 235, 0.3);
}

.portrait-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    pointer-events: none;
}

/* Character display container - clearfix for float */
.obs-character-display::after {
    content: '';
    display: table;
    clear: both;
}

/* Section labels */
.obs-section-label {
    color: #888;
    font-size: 0.85em;
    margin-right: 0.5rem;
}

/* Item names in lists */
.obs-item-name {
    color: #d0d0d0;
}

/* Hand indicator for held items */
.obs-item-hand {
    color: #777;
    font-size: 0.85em;
    margin-left: 0.25rem;
}

/* Legacy clothing/held sections (fallback) */
.obs-clothing-section,
.obs-held-section {
    margin-top: 0.5rem;
}

.obs-clothing-list,
.obs-held-list {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}

.obs-clothing-item,
.obs-held-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

/* ================================
   Canvas Interactivity
   ================================ */

/* Tooltip for canvas hover */
.canvas-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Oxygen', 'Arial', sans-serif;
    pointer-events: none;
    z-index: 10000;
    max-width: 200px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Canvas with hit regions should show pointer on hover */
canvas[data-interactive="true"] {
    cursor: default;
}

canvas[data-interactive="true"]:hover {
    /* Cursor is controlled by JS, but this provides fallback */
}

/* ================================
   Stat Allocation Buttons
   ================================ */
.stat-decrease,
.stat-increase {
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.stat-decrease:disabled,
.stat-increase:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background-color: #3a3a3a !important;
    border-color: #555 !important;
    color: #666 !important;
}

.stat-decrease:not(:disabled):hover,
.stat-increase:not(:disabled):hover {
    transform: scale(1.1);
}

.stat-decrease:not(:disabled):active,
.stat-increase:not(:disabled):active {
    transform: scale(0.95);
}

/* Stat row styling */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-name {
    flex: 1;
    font-weight: 500;
}

.stat-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    min-width: 2em;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

.stat-cost {
    font-size: 0.75em;
    color: #888;
    margin-left: 0.5rem;
    min-width: 2.5em;
    text-align: center;
}

/* Voice Preview Error Alert */
.tts-error-alert {
    animation: fadeIn 0.3s ease;
}

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

/* ================================
   Character Creation Checklist
   ================================ */
.completion-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.completion-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.completion-icon {
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.completion-icon.text-success {
    animation: checkPop 0.3s ease;
}

@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.completion-label {
    font-weight: 500;
}

.completion-detail {
    width: 100%;
    padding-left: 1.75rem;
    font-size: 0.8em;
}


/* ================================
   Contrast Improvements
   ================================ */

/* ================================
   Contrast & Visibility Fixes
   ================================ */

/* Profile page accent color */
.page-banner h1 span,
h1 .text-primary {
    color: var(--prom-accent, #87ceeb) !important;
}

/* Completion checklist detail text */
.completion-detail {
    color: #9ca3af;
}

/* ================================
   DaisyUI Component Tweaks
   ================================ */

/* DaisyUI prose headings should be bright */
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: #e5e7eb;
}

/* Fix: btn-outline without a color variant is nearly invisible on dark theme.
   Give it a visible border and subtle background so it looks like an actual button. */
.btn-outline:not(.btn-primary):not(.btn-secondary):not(.btn-accent):not(.btn-info):not(.btn-success):not(.btn-warning):not(.btn-error):not(.btn-neutral):not(.btn-ghost) {
    border-color: #6b7280;
    color: #d1d5db;
    background-color: rgba(255, 255, 255, 0.04);
}

/* btn-outline + btn-ghost combo: ghost wins for border (transparent),
   but ensure text is clearly visible */
.btn-outline.btn-ghost {
    color: #d1d5db;
}
