/* ============================================
   D&D 5e Spell Manager — Spell Cards Styles
   ============================================ */

/* --- Base Layout --- */
.dndsm-spell-manager {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.dndsm-header {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.dndsm-header h2 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #2c3e50;
    border-bottom: 2px solid #b8a030;
    padding-bottom: 8px;
}

/* --- Inline Slots & Cantrips Header --- */
.dndsm-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.dndsm-header-meta .meta-block {
    flex: 1 1 200px;
    min-width: 180px;
}

.dndsm-header-meta h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-header-meta .dndsm-slot-pill,
.dndsm-header-meta .dndsm-cantrip-pill {
    display: inline-block;
    background: #888;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-family: sans-serif;
}

/* --- Spell Slots Grid (in picker) --- */
.dndsm-spell-slots {
    margin-top: 15px;
}

.dndsm-spell-slots h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.dndsm-slot-control {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.dndsm-slot-control label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: #555;
    margin-bottom: 4px;
}

.dndsm-slot-input {
    width: 50px;
    text-align: center;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dndsm-slot-used {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    color: #27ae60;
}

/* --- Cantrips Section (in picker) --- */
.dndsm-cantrips-section {
    margin-top: 15px;
}

.dndsm-cantrips-section h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-cantrip-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dndsm-cantrip-control label {
    font-size: 13px;
    font-weight: bold;
    color: #555;
}

.dndsm-cantrip-max {
    width: 55px;
    text-align: center;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dndsm-cantrip-count {
    font-size: 13px;
    color: #27ae60;
}

/* --- Prepared Summary & Buttons --- */
.dndsm-prepared-summary {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dndsm-prepared-summary span {
    font-size: 14px;
    color: #555;
}

.dndsm-prepared-summary button {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: sans-serif;
    transition: opacity 0.2s;
}

.dndsm-prepared-summary button:hover {
    opacity: 0.85;
}

.dndsm-clear-all {
    background: #e74c3c;
    color: #fff;
}

.dndsm-collapse-btn {
    background: #3498db;
    color: #fff;
}

.dndsm-view-spellbook-btn {
    background: #27ae60;
    color: #fff;
}

.dndsm-back-to-picker-btn {
    background: #7f8c8d;
    color: #fff;
}

/* --- Filters --- */
.dndsm-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
}

.dndsm-filter-group label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.dndsm-filter-group select,
.dndsm-filter-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: sans-serif;
}

/* --- Spell Grid (Picker) --- */
.dndsm-spell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* --- Spell Card (Picker) --- */
.dndsm-spell-card {
    background: #fff;
    border: 1px solid #ddd;
    border-top: 4px solid #666;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s, transform 0.2s;
}

.dndsm-spell-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.dndsm-spell-card.prepared {
    border-left: 4px solid #27ae60;
    background: #f0fff4;
}

.dndsm-spell-card.hidden-card {
    display: none;
}

.dndsm-card-header {
    margin-bottom: 10px;
}

.dndsm-spell-name {
    margin: 0 0 6px 0;
    font-size: 18px;
    color: #2c3e50;
}

.dndsm-spell-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #666;
}

.dndsm-level {
    font-weight: bold;
    color: #555;
}

.dndsm-badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    font-family: sans-serif;
}

.dndsm-badge.ritual {
    background: #9b59b6;
}

.dndsm-badge.concentration {
    background: #e74c3c;
}

.dndsm-card-details {
    margin-bottom: 10px;
}

.dndsm-detail-row {
    display: flex;
    margin-bottom: 4px;
    font-size: 13px;
}

.dndsm-detail-label {
    font-weight: bold;
    color: #555;
    min-width: 100px;
}

.dndsm-detail-value {
    color: #666;
}

/* --- Spell Description (Picker Card) --- */
.dndsm-spell-card .dndsm-card-description,
.dndsm-spell-card .dndsm-card-description p {
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #111111 !important;
    margin-bottom: 10px;
}

.dndsm-spell-card .dndsm-card-description p {
    margin: 0 0 8px 0;
}

.dndsm-card-upcasting {
    background: #f8f9fa;
    border-left: 3px solid #b8a030;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
}

.dndsm-card-upcasting h4 {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: #b8a030;
}

.dndsm-card-upcasting p {
    margin: 0;
    color: #555;
}

.dndsm-card-classes {
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
}

.dndsm-classes-label {
    font-weight: bold;
    color: #555;
}

.dndsm-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dndsm-source {
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.dndsm-prepare-btn {
    padding: 6px 16px;
    border: 1px solid #3498db;
    background: #fff;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
}

.dndsm-prepare-btn:hover {
    background: #3498db;
    color: #fff;
}

.dndsm-prepare-btn.prepared {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.dndsm-prepare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Reference View --- */
.dndsm-reference-view {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
}

.dndsm-ref-header {
    margin-bottom: 20px;
}

.dndsm-ref-header h2 {
    margin: 0 0 12px 0;
    font-size: 22px;
    color: #2c3e50;
    border-bottom: 2px solid #b8a030;
    padding-bottom: 8px;
}

.dndsm-ref-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.dndsm-ref-header-meta .meta-block {
    flex: 1 1 200px;
    min-width: 180px;
}

.dndsm-ref-header-meta h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-ref-slots,
.dndsm-ref-cantrips {
    min-height: 28px;
}

.dndsm-ref-sections .dndsm-ref-section {
    margin-bottom: 20px;
}

.dndsm-ref-sections .dndsm-ref-section h3 {
    border-bottom: 2px solid #ddd;
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

/* --- Mini Card (Reference) --- */
.dndsm-mini-card {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #666;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dndsm-mini-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.dndsm-mini-card .mini-header h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: #2c3e50;
}

.dndsm-mini-card .mini-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.dndsm-mini-card .mini-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dndsm-mini-card .mini-details span {
    display: inline-block;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #555;
}

.mini-badge {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    font-size: 9px;
    font-weight: bold;
    color: #fff;
    margin-left: 4px;
    font-family: sans-serif;
}

.mini-badge.conc {
    background: #e74c3c;
}

.mini-badge.ritual {
    background: #9b59b6;
}

/* --- Expanded Mini Card --- */
.dndsm-mini-card.expanded {
    grid-column: 1 / -1;
    max-width: 100%;
    cursor: pointer;
}

.dndsm-mini-card .mini-full-details {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.dndsm-mini-card.expanded .mini-full-details {
    display: block;
}

.dndsm-mini-card .mini-full-details .full-desc,
.dndsm-mini-card .mini-full-details .full-desc p {
    font-size: 13px !important;
    line-height: 1.6 !important;
    color: #111111 !important;
    margin-bottom: 10px;
}

.dndsm-mini-card .mini-full-details .full-desc p {
    margin: 0 0 8px 0;
}

.dndsm-mini-card .mini-full-details .full-upcasting {
    background: #f8f9fa;
    border-left: 3px solid #b8a030;
    padding: 8px 12px;
    font-size: 12px;
    color: #555;
    margin-bottom: 8px;
}

.dndsm-mini-card .mini-full-details .full-upcasting strong {
    color: #b8a030;
}

.dndsm-mini-card .mini-full-details .full-classes {
    font-size: 11px;
    color: #777;
}

.dndsm-mini-card .mini-full-details .full-classes strong {
    color: #555;
}

.dndsm-mini-card .mini-expand-hint {
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
    text-align: center;
    font-style: italic;
}

.dndsm-mini-card.expanded .mini-expand-hint {
    display: none;
}

/* --- Prepared Page (Standalone) --- */
.dndsm-prepared-page {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.dndsm-prepared-header {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.dndsm-prepared-header h2 {
    margin: 0 0 12px 0;
    font-size: 22px;
    color: #2c3e50;
    border-bottom: 2px solid #b8a030;
    padding-bottom: 8px;
}

.dndsm-prepared-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.dndsm-prepared-header-meta .meta-block {
    flex: 1 1 200px;
    min-width: 180px;
}

.dndsm-prepared-header-meta h3 {
    margin: 0 0 6px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-prepared-sections .dndsm-prepared-section {
    margin-bottom: 20px;
}

.dndsm-prepared-sections .dndsm-prepared-section h3 {
    border-bottom: 2px solid #ddd;
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b8a030;
}

.dndsm-prepared-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.dndsm-no-prepared {
    color: #999;
    font-style: italic;
    font-size: 13px;
    margin: 0;
}

.dndsm-no-prepared.hidden {
    display: none !important;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .dndsm-slots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .dndsm-spell-grid {
        grid-template-columns: 1fr;
    }
    .dndsm-ref-grid,
    .dndsm-prepared-grid {
        grid-template-columns: 1fr;
    }
    .dndsm-header-meta,
    .dndsm-ref-header-meta,
    .dndsm-prepared-header-meta {
        flex-direction: column;
    }
}