/**
 * Chaotic TCG — Draft System Styles
 * Matches the Chaotic Pro dark theme, neon accents, and responsive layout.
 */

.cps-draft-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 10px;
    color: var(--cps-text, #e0e0e0);
}

/* ─── Lobby List & Cards ─── */
.cps-draft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.cps-draft-card {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.cps-draft-card:hover {
    transform: translateY(-3px);
    border-color: var(--cps-gold, #ffd700);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.cps-draft-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.cps-draft-card h3 {
    margin: 0 0 4px 0;
    color: var(--cps-silver, #f0f0f0);
    font-size: 1.15em;
}

.cps-draft-meta {
    font-size: 0.85em;
    color: var(--cps-text-muted, #999);
    margin: 4px 0;
}

.cps-draft-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cps-draft-status-open {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
}

.cps-draft-status-settings {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid #ffd700;
}

.cps-draft-status-drafting {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    border: 1px solid #e94560;
    animation: cps-pulse 1.5s infinite;
}

.cps-draft-status-completed {
    background: rgba(158, 158, 158, 0.2);
    color: #bbb;
    border: 1px solid #888;
}

@keyframes cps-pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; box-shadow: 0 0 10px rgba(233, 69, 96, 0.5); }
    100% { opacity: 0.8; }
}

/* ─── Set Selector Grid ─── */
.cps-set-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.cps-set-picker-card {
    background: var(--cps-surface2, #1b1b33);
    border: 2px solid var(--cps-silver, #333366);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cps-set-picker-card:hover {
    border-color: var(--cps-accent, #e94560);
    transform: scale(1.03);
}

.cps-set-picker-card.selected {
    border-color: var(--cps-gold, #ffd700);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.08);
}

.cps-set-picker-card img {
    max-width: 70px;
    max-height: 50px;
    object-fit: contain;
    margin-bottom: 6px;
}

.cps-set-picker-card .cps-set-picker-title {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--cps-text, #e0e0e0);
}

/* ─── Toggle Switch (Green on / Black-Transparent off) ─── */
.cps-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    vertical-align: middle;
}

.cps-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cps-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    border: 1px solid var(--cps-silver, #555577);
    transition: 0.3s;
    border-radius: 26px;
}

.cps-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: #bbb;
    transition: 0.3s;
    border-radius: 50%;
}

.cps-switch input:checked + .cps-slider {
    background-color: #2e7d32; /* Rich green */
    border-color: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.cps-switch input:checked + .cps-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* ─── Settings Box ─── */
.cps-draft-settings-box {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 20px;
    margin: 16px 0;
}

.cps-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 16px;
}

.cps-setting-label {
    flex: 1;
}

.cps-setting-label strong {
    display: block;
    font-size: 0.95em;
    color: var(--cps-text, #fff);
}

.cps-setting-label small {
    display: block;
    color: var(--cps-text-muted, #999);
    font-size: 0.8em;
    margin-top: 2px;
}

.cps-number-input {
    width: 80px;
    padding: 6px 10px;
    background: var(--cps-surface2, #1b1b33);
    border: 1px solid var(--cps-silver, #444466);
    border-radius: 6px;
    color: var(--cps-text, #fff);
    font-weight: 600;
    font-size: 0.95em;
    text-align: center;
}

.cps-number-input:focus {
    outline: none;
    border-color: var(--cps-gold, #ffd700);
}

/* ─── CMR Events Table ─── */
.cps-cmr-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.88em;
}

.cps-cmr-table th, .cps-cmr-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cps-cmr-table th {
    color: var(--cps-gold, #ffd700);
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
}

.cps-cmr-pct-badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    color: var(--cps-gold, #ffd700);
    font-weight: 700;
    font-size: 0.85em;
    min-width: 48px;
    text-align: center;
}

.cps-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--cps-gold, #ffd700);
    border-radius: 50%;
    font-size: 0.75em;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

/* Info tooltip hover */
.cps-info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: #111122;
    color: #fff;
    padding: 8px 12px;
    border: 1px solid var(--cps-gold, #ffd700);
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: normal;
    white-space: normal;
    width: 250px;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    line-height: 1.4;
    text-align: left;
    pointer-events: none;
}

/* ─── Draft Active Play Screen ─── */
.cps-draft-play-header {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cps-draft-passed-by {
    font-size: 0.9em;
    color: var(--cps-gold, #ffd700);
    font-weight: 600;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cps-draft-timer-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cps-draft-timer-bar {
    width: 140px;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--cps-silver, #444);
}

.cps-draft-timer-progress {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 1s linear;
}

.cps-draft-timer-progress.warning {
    background: linear-gradient(90deg, #ff9800, #ff5722);
}

.cps-draft-timer-progress.critical {
    background: #e53935;
    animation: cps-pulse 0.6s infinite;
}

.cps-draft-timer-num {
    font-size: 1.1em;
    font-weight: 800;
    font-family: monospace;
    min-width: 40px;
    text-align: right;
}

/* ─── CMR Banner ─── */
.cps-cmr-banner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(233, 69, 96, 0.15));
    border: 2px solid var(--cps-gold, #ffd700);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
    animation: cps-slide-down 0.4s ease;
}

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

.cps-cmr-banner-icon {
    font-size: 1.8em;
}

.cps-cmr-banner-title {
    font-weight: 800;
    color: var(--cps-gold, #ffd700);
    font-size: 1.05em;
    margin-bottom: 2px;
}

.cps-cmr-banner-desc {
    font-size: 0.85em;
    color: var(--cps-text, #e0e0e0);
}

/* ─── Active Pack Card Grid ─── */
.cps-draft-pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.cps-draft-card-item {
    background: var(--cps-surface, #16213e);
    border-radius: 8px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.cps-draft-card-item:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--cps-gold, #ffd700);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.cps-draft-card-item img {
    width: 100%;
    aspect-ratio: 160 / 224;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

.cps-draft-card-item .cps-card-name {
    font-size: 0.8em;
    font-weight: 600;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cps-silver, #f0f0f0);
}

.cps-draft-card-item.selected {
    border-color: #4caf50 !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6) !important;
    background: rgba(76, 175, 80, 0.15);
}

/* ─── Pulled Cards Section ─── */
.cps-draft-pulled-section {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 16px;
    margin-top: 20px;
}

.cps-draft-pulled-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.cps-draft-pulled-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

.cps-draft-pulled-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.15s ease;
}

.cps-draft-pulled-item:hover {
    transform: scale(1.05);
    z-index: 5;
}

.cps-draft-pulled-item img {
    width: 100%;
    aspect-ratio: 160 / 224;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

/* ─── Snipe & Choose Destroy Modals ─── */
.cps-cmr-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    margin: 12px 0;
    background: var(--cps-surface2, #1b1b33);
    border-radius: 8px;
}

.cps-cmr-modal-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px;
    transition: all 0.2s ease;
}

.cps-cmr-modal-item:hover {
    border-color: #e53935;
    background: rgba(229, 57, 53, 0.15);
}

.cps-cmr-modal-item img {
    width: 100%;
    aspect-ratio: 160 / 224;
    object-fit: cover;
    border-radius: 4px;
}

/* ─── Draft Deck Builder ─── */
/* ─── Bot Difficulty Selector Cards ─── */
.cps-bot-diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.cps-bot-diff-card {
    background: var(--cps-surface2, #1b1b33);
    border: 2px solid var(--cps-silver, #333366);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.cps-bot-diff-card:hover {
    border-color: var(--cps-accent, #e94560);
    transform: translateY(-2px);
}

.cps-bot-diff-card.selected {
    border-color: var(--cps-gold, #ffd700);
    background: rgba(255, 215, 0, 0.08);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.cps-bot-diff-title {
    font-weight: 700;
    color: var(--cps-gold, #ffd700);
    font-size: 0.95em;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cps-bot-diff-desc {
    font-size: 0.8em;
    color: var(--cps-text, #ccc);
    line-height: 1.35;
}

.cps-cpu-badge {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid #2196f3;
    color: #64b5f6;
    font-size: 0.7em;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

/* ─── Demonic Red/Black Glowing Aura Failsafe Button ─── */
.cps-btn-demonic {
    background: radial-gradient(circle, #2a0000 0%, #0a0000 100%) !important;
    border: 2px solid #ff1744 !important;
    color: #ff5252 !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
    text-shadow: 0 0 6px #ff1744, 0 0 12px #d50000 !important;
    box-shadow: 0 0 14px rgba(255, 23, 68, 0.7), inset 0 0 10px rgba(255, 23, 68, 0.4), 0 0 25px rgba(0, 0, 0, 0.9) !important;
    animation: cps-demonic-pulse 1.4s infinite alternate ease-in-out !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.cps-btn-demonic:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 0 22px rgba(255, 23, 68, 0.95), inset 0 0 14px rgba(255, 23, 68, 0.6), 0 0 35px rgba(213, 0, 0, 0.8) !important;
    color: #ffffff !important;
    text-shadow: 0 0 10px #ff1744, 0 0 20px #ff5252 !important;
}

@keyframes cps-demonic-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 23, 68, 0.5), inset 0 0 6px rgba(255, 23, 68, 0.3), 0 0 20px rgba(0, 0, 0, 0.8);
        border-color: #d50000;
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 23, 68, 0.85), inset 0 0 12px rgba(255, 23, 68, 0.5), 0 0 30px rgba(255, 23, 68, 0.4);
        border-color: #ff5252;
    }
}

.cps-ddb-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    margin-top: 14px;
}

.cps-ddb-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cps-ddb-right {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}

.cps-ddb-pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

.cps-ddb-pool-card {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.15s ease;
}

.cps-ddb-pool-card:hover {
    transform: translateY(-2px) scale(1.04);
}

.cps-ddb-pool-card img {
    width: 100%;
    aspect-ratio: 160 / 224;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.cps-ddb-pool-qty {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.85);
    color: var(--cps-gold, #ffd700);
    border: 1px solid var(--cps-gold, #ffd700);
    font-size: 0.72em;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 4px;
}

.cps-ddb-pool-card.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.cps-ddb-validation-banner {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cps-ddb-validation-banner.legal {
    background: rgba(46, 125, 50, 0.18);
    border: 1px solid #4caf50;
    color: #81c784;
}

.cps-ddb-validation-banner.illegal {
    background: rgba(229, 57, 53, 0.18);
    border: 1px solid #e53935;
    color: #ef9a9a;
}

.cps-ddb-battlefield {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 16px;
}

.cps-ddb-bf-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.cps-ddb-bf-row {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.cps-ddb-creature-slot {
    width: 110px;
    background: var(--cps-surface2, #1b1b33);
    border: 2px dashed var(--cps-silver, #444466);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-height: 155px;
    position: relative;
    transition: all 0.2s ease;
}

.cps-ddb-creature-slot.occupied {
    border-style: solid;
    border-color: #ffd700;
}

.cps-ddb-creature-slot img {
    width: 100%;
    aspect-ratio: 160 / 224;
    object-fit: cover;
    object-position: top;
    border-radius: 4px;
}

.cps-ddb-gear-slot {
    width: 100%;
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed var(--cps-silver, #555);
    border-radius: 4px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: var(--cps-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

.cps-ddb-gear-slot.occupied {
    border-style: solid;
    border-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.15);
    color: #fff;
    font-weight: 600;
}

.cps-ddb-subsections {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.cps-ddb-subbox {
    background: var(--cps-surface, #16213e);
    border: 1px solid var(--cps-surface2, #232946);
    border-radius: 10px;
    padding: 12px;
}

.cps-ddb-subbox h4 {
    margin: 0 0 8px 0;
    color: var(--cps-gold, #ffd700);
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
}

.cps-ddb-subgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 6px;
    min-height: 70px;
}

.cps-ddb-subslot {
    aspect-ratio: 160 / 224;
    background: var(--cps-surface2, #1b1b33);
    border: 1px dashed var(--cps-silver, #444);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.cps-ddb-subslot.occupied {
    border-style: solid;
    border-color: #ffd700;
}

.cps-ddb-subslot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cps-ddb-drop-hover {
    outline: 2px dashed var(--cps-gold, #ffd700) !important;
    outline-offset: 2px;
    background: rgba(255, 215, 0, 0.15) !important;
}

.cps-ddb-remove-zone {
    border: 2px dashed rgba(229, 57, 53, 0.6);
    background: rgba(229, 57, 53, 0.08);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    color: #ef9a9a;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.cps-ddb-remove-zone.cps-ddb-drop-hover {
    border-color: #ff1744 !important;
    background: rgba(255, 23, 68, 0.25) !important;
    color: #fff !important;
    transform: scale(1.02);
}

.cps-ddb-bp-counter {
    background: var(--cps-surface2, #1b1b33);
    border: 1px solid var(--cps-silver, #444466);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 900px) {
    .cps-ddb-layout {
        grid-template-columns: 1fr;
    }
    .cps-ddb-subsections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .cps-draft-play-header {
        flex-direction: column;
        align-items: stretch;
    }
    .cps-draft-timer-box {
        justify-content: space-between;
    }
    .cps-draft-timer-bar {
        flex: 1;
    }
}
