/* === Components: Cards, Dots, Modals, Buttons, Tabs === */

/* Hero Header */
.hero-header {
    background:
        linear-gradient(135deg, #2a2418 0%, #1e1b16 40%, #221f1a 100%);
    border: 1px solid #4a3f30;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.4);
    position: relative;
}

/* Parchment texture overlay */
.hero-header::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' seed='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23p)' opacity='1'/%3E%3C/svg%3E");
    border-radius: inherit;
}

/* Corner flourishes */
.hero-header::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(212, 160, 23, 0.15);
    border-radius: 8px;
    pointer-events: none;
    mask-image:
        linear-gradient(135deg, #000 12px, transparent 12px),
        linear-gradient(225deg, #000 12px, transparent 12px),
        linear-gradient(315deg, #000 12px, transparent 12px),
        linear-gradient(45deg, #000 12px, transparent 12px);
    mask-composite: add;
    -webkit-mask-image:
        linear-gradient(135deg, #000 12px, transparent 12px),
        linear-gradient(225deg, #000 12px, transparent 12px),
        linear-gradient(315deg, #000 12px, transparent 12px),
        linear-gradient(45deg, #000 12px, transparent 12px);
    -webkit-mask-composite: source-over;
}

/* Light mode hero */
[data-mode="light"] .hero-header {
    background: linear-gradient(135deg, #f9f5ef 0%, #fff 40%, #f5f0e8 100%);
    border-color: #d4c9b8;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.06);
}
[data-mode="light"] .hero-header::after {
    border-color: rgba(180, 140, 60, 0.2);
}

/* Cards */
.card {
    background: linear-gradient(145deg, #221f1a, #1e1b16);
    border: 1px solid #3d362a;
    border-left: 3px solid transparent;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px #0005;
    transition: border-left-color 0.2s, border-left-width 0.2s, box-shadow 0.2s;
}

.accent-status:hover { border-left-color: var(--accent-1); }
.accent-combat:hover { border-left-color: var(--accent-2); }
.accent-gold:hover { border-left-color: var(--accent-3); }
.accent-abilities:hover { border-left-color: var(--accent-4); }
.accent-experience:hover { border-left-color: var(--accent-5); }
.accent-levelup:hover { border-left-color: var(--accent-1); }
.accent-backstory:hover { border-left-color: var(--accent-2); }
.accent-description:hover { border-left-color: var(--accent-3); }
.accent-connections:hover { border-left-color: var(--accent-4); }

/* Sheet cards (added to sheet) */
.sheet-card {
    background: linear-gradient(145deg, #1a1714, #1e1b16);
    border: 1px solid #3d362a;
    border-left: 3px solid #3d362a;
    border-radius: 10px;
    padding: 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.sheet-card:hover { border-color: #5a4d3a; }
#domainCards .sheet-card { opacity: 0.5; }
#domainCards .domain-card-selected.sheet-card { opacity: 1; }

/* Domain cards — TCG card feel */
#domainCards .sheet-card {
    position: relative;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    overflow: hidden;
}
#domainCards .sheet-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' seed='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23c)' opacity='1'/%3E%3C/svg%3E");
}
#domainCards .sheet-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
}
#domainCards .domain-card-selected.sheet-card {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px color-mix(in srgb, var(--accent-1) 20%, transparent);
}

/* Domain icon badge */
.domain-icon-badge {
    width: 28px;
    height: 28px;
    padding: 4px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
[data-mode="light"] .domain-icon-badge {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.08);
}

/* Domain card selected */
.domain-card-selected {
    background-color: #2a2418 !important;
    border: 1px solid var(--accent-1) !important;
    animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
    0%, 100% { box-shadow: 0 0 8px color-mix(in srgb, var(--accent-1) 15%, transparent), inset 0 0 6px color-mix(in srgb, var(--accent-1) 8%, transparent); }
    50% { box-shadow: 0 0 18px color-mix(in srgb, var(--accent-1) 30%, transparent), inset 0 0 12px color-mix(in srgb, var(--accent-1) 15%, transparent); }
}

/* Tracker dots — orb/gem effect */
.dot {
    width: 24px;
    height: 24px;
    border: 2px solid #4a3f30;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    background: radial-gradient(circle at 35% 35%, #3d362a 0%, #1a1714 100%);
}
.dot:hover { border-color: #8b7355; transform: scale(1.1); }

/* Light mode empty dots — inset socket feel */
[data-mode="light"] .dot:not([class*="filled-"]) {
    border-color: #c4b8a8;
    background: radial-gradient(circle at 35% 35%, #fff 0%, #d4c9b8 70%, #b8a990 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.12);
}
[data-mode="light"] .dot:not([class*="filled-"]):hover {
    border-color: #a89880;
}

.dot.filled-hp {
    border-color: #c0392b;
    background: radial-gradient(circle at 35% 35%, #e74c3c 0%, #922b21 60%, #641e16 100%);
    box-shadow: 0 0 8px #c0392b80, inset 0 -2px 4px #00000040;
}
.dot.filled-armor {
    border-color: #2980b9;
    background: radial-gradient(circle at 35% 35%, #5dade2 0%, #2471a3 60%, #1a5276 100%);
    box-shadow: 0 0 8px #2980b980, inset 0 -2px 4px #00000040;
}
.dot.filled-stress {
    border-color: #8e44ad;
    background: radial-gradient(circle at 35% 35%, #bb8fce 0%, #7d3c98 60%, #512e5f 100%);
    box-shadow: 0 0 8px #8e44ad80, inset 0 -2px 4px #00000040;
}
.dot.filled-hope {
    border-color: #d4a017;
    background: radial-gradient(circle at 35% 35%, #f4d03f 0%, #d4a017 60%, #9a7d0a 100%);
    box-shadow: 0 0 8px #d4a01780, inset 0 -2px 4px #00000040;
}

/* Buttons */
.btn-action {
    background: linear-gradient(135deg, var(--accent-4), var(--accent-3));
    border: none;
}
.btn-action:hover { background: linear-gradient(135deg, var(--accent-3), var(--accent-2)); }
.btn-danger { background: linear-gradient(135deg, #6b1a1a, #8b2020); }

/* Tabs */
.tab-btn { transition: all 0.2s ease; }
.tab-btn:hover { opacity: 0.9; }

/* Theme picker */
.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}
.theme-swatch:hover { transform: scale(1.15); }
.theme-swatch.active { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.3); }

/* Chevron rotation */
.toggle-icon { display: inline-block; transition: transform 0.25s ease; }
.toggle-icon.collapsed { transform: rotate(-90deg); }

/* Modal */
.modal-overlay { backdrop-filter: blur(4px); background: rgba(0,0,0,0.85); }
.modal-panel {
    background: linear-gradient(145deg, #252118, #1e1b16);
    border: 1px solid #4a3f30;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* Card detail modal text */
.card-detail-content, .card-detail-content * { font-size: 1rem !important; line-height: 1.8 !important; }
.card-detail-content .text-amber-400 { font-size: 1.1rem !important; font-weight: 700; }

/* Drag & drop reordering */
.dragging { opacity: 0.4; }
.drag-over { border-top: 2px solid var(--accent-1); }

/* Info tooltip */
.info-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #4a3f30;
    background: transparent;
    color: #6b5d4d;
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.info-btn:hover { border-color: var(--accent-1); color: var(--accent-1); }
.info-popup {
    display: none;
    background: #1e1b16;
    border: 1px solid #4a3f30;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 8px;
    font-size: 11px;
    color: #a89880;
    line-height: 1.6;
}
.info-popup.open { display: block; }
[data-mode="light"] .info-btn { border-color: #d4c9b8; color: #8b7d6b; }
[data-mode="light"] .info-btn:hover { border-color: var(--accent-1); color: var(--accent-1); }
[data-mode="light"] .info-popup { background: #fff; border-color: #d4c9b8; color: #6b5d4d; }
