/* The Ashen Veil - Custom Styles */

/* Additional custom styles beyond Tailwind */

/* Tree navigation styles */
.tree-nav {
    list-style: none;
    padding-left: 0;
}

.tree-nav li {
    margin: 0.25rem 0;
}

.tree-nav button {
    width: 100%;
    text-align: left;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.tree-nav button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.tree-nav ul {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

/* Character wizard steps */
.wizard-step {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.wizard-step.active {
    opacity: 1;
    transform: translateX(0);
}

/* Card hover effects */
.character-card:hover {
    transform: translateY(-4px);
    transition: transform 0.2s;
}

/* Content formatting */
.content-body h1, .content-body h2, .content-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.content-body p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.content-body ul, .content-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content-body table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.content-body th, .content-body td {
    padding: 0.5rem;
    border: 1px solid var(--border);
}

.content-body th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

/* Loading states */
.loading {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--border);
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Print styles */
@media print {
    header, footer, .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}

/* Image Lightbox Styles */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in-out;
}

.image-lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(4px);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container {
    max-width: 95%;
    max-height: 95%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    transition: transform 0.2s ease-out;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10001;
}

.lightbox-close:hover {
    background-color: rgba(139, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 12px 20px;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    z-index: 10001;
}

.lightbox-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-controls button:hover {
    background-color: rgba(139, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.lightbox-controls button:active {
    transform: scale(0.95);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Dark mode adjustments (if needed) */
[data-theme="light"] .lightbox-backdrop {
    background-color: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .lightbox-close,
[data-theme="light"] .lightbox-controls {
    background-color: rgba(255, 255, 255, 0.9);
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .lightbox-controls button {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .lightbox-close:hover,
[data-theme="light"] .lightbox-controls button:hover {
    background-color: rgba(139, 0, 0, 0.15);
}

/* Greywatch theme lightbox adjustments */
.greywatch .lightbox-close:hover {
    background-color: rgba(0, 255, 242, 0.9);  /* Cyan instead of red */
    border-color: rgba(0, 212, 204, 0.8);
}

.greywatch .lightbox-controls button:hover {
    background-color: rgba(0, 212, 204, 0.8);  /* Cyan instead of red */
    border-color: rgba(0, 255, 242, 0.6);
}

/* ==========================================================================
   MOBILE NAVIGATION STYLES
   ========================================================================== */

/* Mobile nav link styling */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    font-size: 1.1rem;
}

.mobile-nav-link:hover {
    background-color: var(--bg-primary);
}

.mobile-nav-link i {
    width: 1.5rem;
    text-align: center;
}

/* Ensure touch targets are minimum 44px on mobile */
@media (max-width: 768px) {
    .nav-link, .mobile-nav-link, button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Prevent body scroll when mobile menu is open */
@media (max-width: 768px) {
    body.menu-open {
        overflow: hidden;
    }
}

/* ==================== Portrait Edit Overlay ==================== */

.portrait-edit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Show portrait overlay in edit mode */
body.edit-mode .portrait-layer:hover .portrait-edit-overlay {
    opacity: 1;
    pointer-events: auto;
}

.portrait-edit-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

.portrait-edit-buttons button {
    white-space: nowrap;
    font-size: 0.875rem;
}

/* Edit mode visual indicators */
body.edit-mode .editable-field {
    position: relative;
}

body.edit-mode .editable-field::after {
    content: '✎';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0.6;
}

/* ==================== Item Card System ==================== */

/* Compact Item Cards */
.item-card.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 140px;
    position: relative;
}

.item-card.compact:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.item-card.compact.add-card {
    border-style: dashed;
    opacity: 0.7;
}

.item-card.compact.add-card:hover {
    opacity: 1;
    background: var(--bg-primary);
}

.item-card-image {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.item-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.25rem;
}

.item-card-name {
    font-weight: bold;
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.item-card-quantity {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Detail Cards */
.item-detail-card {
    background: var(--bg-secondary);
    border: 2px solid var(--primary);
    border-left: 4px solid var(--primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.item-detail-image {
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Edit-only elements visibility */
body.edit-mode .edit-only {
    display: block !important;
}

body.edit-mode .item-card.add-card.edit-only {
    display: flex !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .item-card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .item-detail-card {
        padding: 1rem;
    }

    .item-detail-card .flex {
        flex-direction: column;
    }

    .item-detail-image {
        width: 100% !important;
        max-width: 200px;
        margin: 0 auto 1rem;
    }
}
