/* ============================================
   NIGHTFALL DOMINION - TOOLKIT STYLES v2.0
   ============================================ */

:root {
    --nd-primary: #6c3b8a;
    --nd-primary-light: #8b5ca8;
    --nd-primary-dark: #4a2a5e;
    --nd-secondary: #2a4a6c;
    --nd-accent: #c9a84c;
    --nd-danger: #a83c4a;
    --nd-success: #3a8a5c;
    --nd-bg: #1a1a2e;
    --nd-card-bg: #16213e;
    --nd-text: #e8e0d4;
    --nd-muted: #9a8a7a;
    --nd-border: #2a3a5a;
    --nd-shadow: rgba(0, 0, 0, 0.6);
    --nd-radius: 8px;
    --nd-transition: 0.3s ease;
}

/* Reset & Base */
.nd-toolkit-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
    color: var(--nd-text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--nd-bg);
}

.nd-toolkit-wrap * {
    box-sizing: border-box;
}

/* Typography */
.nd-toolkit-wrap h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0.25rem 0;
    background: linear-gradient(135deg, var(--nd-primary-light), var(--nd-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nd-toolkit-wrap h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.75rem 0;
    border-bottom: 2px solid var(--nd-border);
    padding-bottom: 0.5rem;
}

.nd-muted {
    color: var(--nd-muted);
    font-size: 0.9rem;
    margin: 0 0 0.25rem 0;
}

/* ============================================
   CAMPAIGN SELECTOR MEJORADO
   ============================================ */

/* Contenedor principal */
.nd-campaign-selector {
    background: var(--nd-card-bg);
    border-radius: var(--nd-radius);
    border: 1px solid var(--nd-border);
    overflow: hidden;
    min-width: 200px;
}

/* Header del selector */
.nd-campaign-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--nd-border);
}

.nd-campaign-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nd-muted);
    font-weight: 600;
}

/* Lista de campañas */
.nd-campaign-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
}

.nd-campaign-list::-webkit-scrollbar {
    width: 3px;
}

.nd-campaign-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.nd-campaign-list::-webkit-scrollbar-thumb {
    background: var(--nd-primary);
    border-radius: 4px;
}

/* Item de campaña */
.nd-campaign-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--nd-text);
    font-size: 0.85rem;
}

.nd-campaign-item:hover {
    background: rgba(108, 59, 138, 0.15);
}

.nd-campaign-item.active {
    background: rgba(108, 59, 138, 0.25);
    border-left: 3px solid var(--nd-primary);
}

.nd-campaign-item .nd-campaign-status {
    font-size: 0.7rem;
    opacity: 0.8;
}

.nd-campaign-item .nd-campaign-name {
    flex: 1;
    font-weight: 500;
}

.nd-campaign-item .nd-campaign-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--nd-muted);
}

.nd-campaign-item .nd-campaign-check {
    color: var(--nd-success);
    font-weight: 700;
    font-size: 1rem;
}

.nd-campaign-item.active .nd-campaign-badge {
    background: rgba(108, 59, 138, 0.3);
    color: var(--nd-primary-light);
}

/* Estados vacío y error */
.nd-empty-state,
.nd-error-state {
    padding: 1rem;
    text-align: center;
}

.nd-empty-state .nd-text-muted {
    margin-bottom: 0.5rem;
}

/* ============================================
   TOOLKIT HERO MEJORADO
   ============================================ */

.nd-toolkit-hero {
    background: linear-gradient(135deg, var(--nd-primary-dark), var(--nd-secondary));
    padding: 2rem;
    border-radius: var(--nd-radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--nd-border);
    position: relative;
    overflow: hidden;
}

.nd-toolkit-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(108, 59, 138, 0.15), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.nd-toolkit-hero h1 {
    position: relative;
    z-index: 1;
}

.nd-toolkit-hero p {
    position: relative;
    z-index: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .nd-campaign-selector {
        min-width: auto;
        width: 100%;
    }
    
    .nd-campaign-list {
        max-height: 150px;
    }
    
    .nd-campaign-item {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    
    .nd-toolkit-hero {
        padding: 1.25rem;
    }
}

/* ============================================
   TRANSICIONES SUAVES
   ============================================ */

.nd-campaign-item {
    transition: all 0.2s ease-in-out;
}

.nd-campaign-item .nd-campaign-check {
    transition: all 0.2s ease-in-out;
    opacity: 0;
    transform: scale(0.5);
}

.nd-campaign-item.active .nd-campaign-check {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   TOOLTIP PARA CAMPAÑAS
   ============================================ */

.nd-campaign-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nd-card-bg);
    color: var(--nd-text);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid var(--nd-border);
    white-space: nowrap;
    z-index: 10;
}
/* Hero Section */
.nd-toolkit-hero {
    background: linear-gradient(135deg, var(--nd-primary-dark), var(--nd-secondary));
    padding: 2rem;
    border-radius: var(--nd-radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--nd-border);
}

.nd-toolkit-hero p:last-of-type {
    color: var(--nd-muted);
    max-width: 600px;
    line-height: 1.6;
}

/* Buttons */
.nd-btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--nd-primary);
    color: #fff;
    border: none;
    border-radius: var(--nd-radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--nd-transition);
    text-decoration: none;
}

.nd-btn:hover {
    background: var(--nd-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 59, 138, 0.4);
}

.nd-btn.secondary {
    background: var(--nd-secondary);
}

.nd-btn.secondary:hover {
    background: #3a6a8a;
}

.nd-btn.ghost {
    background: transparent;
    border: 1px solid var(--nd-border);
    color: var(--nd-text);
}

.nd-btn.ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nd-btn.danger {
    background: var(--nd-danger);
}

.nd-btn.danger:hover {
    background: #c84a5a;
}

.nd-btn.success {
    background: var(--nd-success);
}

.nd-btn.success:hover {
    background: #4a9a6c;
}

.nd-btn.small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.nd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.nd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

/* KPI Dashboard */
.nd-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.nd-kpi .box {
    background: var(--nd-card-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--nd-radius);
    border: 1px solid var(--nd-border);
    text-align: center;
}

.nd-kpi .box span {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--nd-muted);
}

.nd-kpi .box b {
    display: block;
    font-size: 1.8rem;
    color: #fff;
    margin-top: 0.1rem;
}

/* Grid Layout */
.nd-app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .nd-app-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.nd-card {
    background: var(--nd-card-bg);
    padding: 1.25rem;
    border-radius: var(--nd-radius);
    border: 1px solid var(--nd-border);
}

/* Stat Rows */
.nd-stat-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.nd-stat-row span:first-child {
    flex: 0 0 80px;
    color: var(--nd-muted);
    font-size: 0.85rem;
}

.nd-stat-row strong {
    flex: 1;
    font-size: 1.3rem;
    color: #fff;
}

.nd-stat-row .nd-counter {
    display: flex;
    gap: 0.25rem;
}

.nd-stat-row .nd-counter button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--nd-border);
    background: transparent;
    color: var(--nd-text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--nd-transition);
}

.nd-stat-row .nd-counter button:hover {
    background: var(--nd-primary);
    border-color: var(--nd-primary);
}

/* Forms */
.nd-card label {
    display: block;
    font-size: 0.8rem;
    color: var(--nd-muted);
    margin: 0.5rem 0 0.2rem 0;
}

.nd-card input[type="number"],
.nd-card select,
.nd-card textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    color: var(--nd-text);
    font-size: 0.9rem;
    transition: var(--nd-transition);
}

.nd-card input[type="number"]:focus,
.nd-card select:focus,
.nd-card textarea:focus {
    outline: none;
    border-color: var(--nd-primary);
    box-shadow: 0 0 0 2px rgba(108, 59, 138, 0.2);
}

.nd-card textarea {
    min-height: 60px;
    resize: vertical;
}

/* Generator Output */
.nd-generator-output {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-radius: var(--nd-radius);
    margin-top: 0.75rem;
    min-height: 50px;
    font-size: 0.9rem;
    line-height: 1.6;
    border-left: 3px solid var(--nd-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Tabs */
.nd-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.nd-tab {
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius) var(--nd-radius) 0 0;
    color: var(--nd-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--nd-transition);
}

.nd-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nd-tab.active {
    background: var(--nd-primary);
    color: #fff;
    border-color: var(--nd-primary);
}

.nd-panel {
    display: none;
    padding: 0.75rem 0;
}

.nd-panel.active {
    display: block;
}

/* List */
.nd-list {
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
    margin: 0.5rem 0;
}

.nd-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.nd-list-item .nd-tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    background: var(--nd-primary-dark);
    color: var(--nd-muted);
}

.nd-list-item .nd-remove {
    background: transparent;
    border: none;
    color: var(--nd-danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
}

/* Log */
.nd-log {
    min-height: 80px;
    max-height: 250px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: var(--nd-radius);
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.nd-log-entry {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--nd-muted);
}

.nd-log-entry .nd-time {
    color: var(--nd-accent);
    font-weight: 600;
    margin-right: 0.5rem;
}

.nd-log-entry.nd-log-combat {
    border-left: 3px solid var(--nd-danger);
    padding-left: 0.75rem;
}

.nd-log-entry.nd-log-discovery {
    border-left: 3px solid var(--nd-accent);
    padding-left: 0.75rem;
}

.nd-log-entry.nd-log-note {
    border-left: 3px solid var(--nd-primary);
    padding-left: 0.75rem;
}

/* Threat Meter */
.nd-threat-meter {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.nd-threat-meter .nd-threat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--nd-success), var(--nd-accent), var(--nd-danger));
}

/* Scrollbar */
.nd-list::-webkit-scrollbar,
.nd-log::-webkit-scrollbar {
    width: 4px;
}

.nd-list::-webkit-scrollbar-track,
.nd-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.nd-list::-webkit-scrollbar-thumb,
.nd-log::-webkit-scrollbar-thumb {
    background: var(--nd-primary);
    border-radius: 4px;
}

/* Utility */
.nd-flex {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nd-mt-1 { margin-top: 0.5rem; }
.nd-mb-1 { margin-bottom: 0.5rem; }
.nd-text-center { text-align: center; }
.nd-text-muted { color: var(--nd-muted); }
.nd-text-accent { color: var(--nd-accent); }
.nd-text-danger { color: var(--nd-danger); }

/* Flash / Toast */
.nd-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--nd-card-bg);
    border: 1px solid var(--nd-border);
    padding: 1rem 1.5rem;
    border-radius: var(--nd-radius);
    color: var(--nd-text);
    box-shadow: 0 8px 24px var(--nd-shadow);
    z-index: 9999;
    max-width: 400px;
    animation: ndSlideUp 0.3s ease;
}

.nd-toast-success { border-left: 4px solid var(--nd-success); }
.nd-toast-danger { border-left: 4px solid var(--nd-danger); }
.nd-toast-warning { border-left: 4px solid var(--nd-accent); }

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

/* ============================================
   DICE KPI
   ============================================ */

.nd-dice-kpi {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 0.75rem 0;
}

.nd-dice-kpi .nd-dice-box {
    background: var(--nd-card-bg);
    padding: 0.3rem 0.8rem;
    border-radius: var(--nd-radius);
    border: 1px solid var(--nd-border);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 0 0 auto;
}

.nd-dice-kpi .nd-dice-box .nd-dice-icon {
    font-size: 1rem;
}

.nd-dice-kpi .nd-dice-box .nd-dice-label {
    color: var(--nd-muted);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nd-dice-kpi .nd-dice-box .nd-dice-value {
    font-weight: 700;
    color: var(--nd-accent);
    font-size: 0.8rem;
}