/**
 * Card Details Section – CSS
 * Covers: section wrapper, two-column uploader layout,
 *         preview, drop zone, card number input.
 *
 * @package CardTrading
 */

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
    --ct-primary      : #1a3c5e;
    --ct-accent       : #e8a020;
    --ct-border       : #d9dde8;
    --ct-bg           : #f5f7fa;
    --ct-bg-hover     : #eef1f7;
    --ct-text         : #2c3a4a;
    --ct-muted        : #7a8799;
    --ct-danger       : #c0392b;
    --ct-danger-hover : #a93226;
    --ct-radius       : 10px;
    --ct-radius-sm    : 6px;
    --ct-shadow       : 0 2px 12px rgba(0, 0, 0, .08);
    --ct-shadow-hover : 0 6px 24px rgba(0, 0, 0, .14);
    --ct-transition   : .22s ease;
}

/* ── Utility ───────────────────────────────────────────────────────── */
.ct-hidden {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════════
   Section wrapper
══════════════════════════════════════════════════════════════════════ */
.ct-card-section {
    background    : #fff;
    border        : 1px solid var(--ct-border);
    border-radius : var(--ct-radius);
    box-shadow    : var(--ct-shadow);
    margin-bottom : 24px;
    overflow      : hidden;
}

/* ── Section header ────────────────────────────────────────────────── */
.ct-card-section__header {
    display          : flex;
    align-items      : center;
    gap              : 10px;
    padding          : 16px 22px;
    background       : var(--ct-primary);
    color            : #fff;
}

.ct-card-section__icon {
    font-size : 20px;
}

.ct-card-section__title {
    margin      : 0;
    font-size   : 16px;
    font-weight : 600;
    letter-spacing: .3px;
    color       : #fff;
}

/* ── Section body ──────────────────────────────────────────────────── */
.ct-card-section__body {
    padding : 24px 22px;
}

/* ══════════════════════════════════════════════════════════════════════
   Grid rows / columns
══════════════════════════════════════════════════════════════════════ */
.ct-card-row {
    display               : grid;
    grid-template-columns : 1fr 1fr;
    gap                   : 20px;
    margin-bottom         : 22px;
}

.ct-card-row:last-child {
    margin-bottom : 0;
}

/* Single-column override (card number row) */
.ct-card-row--single {
    grid-template-columns : 1fr;
}

.ct-card-col--full {
    grid-column : 1 / -1;
}

/* Responsive: stack on small screens */
@media ( max-width: 640px ) {
    .ct-card-row {
        grid-template-columns : 1fr;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Field labels
══════════════════════════════════════════════════════════════════════ */
.ct-card-label {
    display       : flex;
    align-items   : center;
    gap           : 6px;
    font-size     : 13px;
    font-weight   : 600;
    color         : var(--ct-text);
    margin-bottom : 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.ct-card-label__icon {
    font-size : 15px;
    color     : var(--ct-accent);
}

/* ══════════════════════════════════════════════════════════════════════
   Uploader block
══════════════════════════════════════════════════════════════════════ */
.ct-uploader {
    display        : flex;
    flex-direction : column;
    gap            : 10px;
}

/* ── Preview (image + remove button) ──────────────────────────────── */
.ct-uploader__preview {
    position      : relative;
    display       : inline-block;
    border-radius : var(--ct-radius-sm);
    overflow      : hidden;
    box-shadow    : var(--ct-shadow);
    transition    : box-shadow var(--ct-transition);
}

.ct-uploader__preview:hover {
    box-shadow : var(--ct-shadow-hover);
}

.ct-uploader__img {
    display    : block;
    width      : 100%;
    max-width  : 280px;
    height     : 180px;
    object-fit : cover;
    border-radius : var(--ct-radius-sm);
}

.ct-uploader__remove {
    position         : absolute;
    top              : 6px;
    right            : 6px;
    width            : 28px;
    height           : 28px;
    border           : none;
    border-radius    : 50%;
    background       : var(--ct-danger);
    color            : #fff;
    font-size        : 13px;
    cursor           : pointer;
    display          : flex;
    align-items      : center;
    justify-content  : center;
    transition       : background var(--ct-transition), transform var(--ct-transition);
    box-shadow       : 0 2px 6px rgba(0,0,0,.25);
}

.ct-uploader__remove:hover {
    background  : var(--ct-danger-hover);
    transform   : scale(1.1);
}

/* ── Drop zone ─────────────────────────────────────────────────────── */
.ct-uploader__dropzone {
    width            : 100%;
    max-width        : 280px;
    height           : 180px;
    border           : 2px dashed var(--ct-border);
    border-radius    : var(--ct-radius);
    background       : var(--ct-bg);
    display          : flex;
    flex-direction   : column;
    align-items      : center;
    justify-content  : center;
    gap              : 8px;
    cursor           : pointer;
    transition       : border-color var(--ct-transition),
                       background   var(--ct-transition);
}

.ct-uploader__dropzone:hover,
.ct-uploader__dropzone.ct-drag-over {
    border-color : var(--ct-accent);
    background   : var(--ct-bg-hover);
}

.ct-uploader__dropzone-icon {
    font-size : 32px;
    color     : var(--ct-muted);
    transition: color var(--ct-transition);
}

.ct-uploader__dropzone:hover .ct-uploader__dropzone-icon,
.ct-uploader__dropzone.ct-drag-over .ct-uploader__dropzone-icon {
    color : var(--ct-accent);
}

.ct-uploader__dropzone-text {
    margin    : 0;
    font-size : 12px;
    color     : var(--ct-muted);
}

/* ── Upload / Change button ────────────────────────────────────────── */
.ct-uploader__btn {
    align-self       : flex-start;
    display          : inline-flex;
    align-items      : center;
    gap              : 6px;
    padding          : 7px 16px;
    border           : 1px solid var(--ct-primary);
    border-radius    : var(--ct-radius-sm);
    background       : #fff;
    color            : var(--ct-primary);
    font-size        : 13px;
    font-weight      : 600;
    cursor           : pointer;
    transition       : background var(--ct-transition),
                       color      var(--ct-transition);
}

.ct-uploader__btn::before {
    content     : "\f161";          /* dashicon: upload */
    font-family : dashicons;
    font-size   : 15px;
}

.ct-uploader__btn:hover {
    background : var(--ct-primary);
    color      : #fff;
}

/* ══════════════════════════════════════════════════════════════════════
   Card Title Custom Select (Scrollable)
══════════════════════════════════════════════════════════════════════ */
.ct-card-title-wrap {
    max-width: 420px;
}

/* Custom Select Container */
.ct-custom-select {
    position: relative;
    width: 100%;
}

/* Display Box */
.ct-custom-select__display {
    width: 100%;
    padding: 11px 40px 11px 16px;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    font-size: 15px;
    color: var(--ct-text);
    background: var(--ct-bg);
    transition: border-color var(--ct-transition),
                box-shadow var(--ct-transition);
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.ct-custom-select__display:hover {
    border-color: var(--ct-accent);
}

.ct-custom-select__display:focus,
.ct-custom-select__display.active {
    outline: none;
    border-color: var(--ct-accent);
    box-shadow: 0 0 0 3px rgba(232, 160, 32, .18);
    background: #fff;
}

.ct-custom-select__value {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-custom-select__arrow {
    display: flex;
    align-items: center;
    color: var(--ct-muted);
    transition: transform var(--ct-transition);
    flex-shrink: 0;
}

.ct-custom-select__display.active .ct-custom-select__arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.ct-custom-select__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease,
                opacity 0.2s ease,
                visibility 0.2s;
    z-index: 100;
}

.ct-custom-select__dropdown.open {
    max-height: 240px; /* Scrollable after ~8-10 items */
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
}

/* Custom scrollbar for dropdown */
.ct-custom-select__dropdown::-webkit-scrollbar {
    width: 6px;
}

.ct-custom-select__dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.ct-custom-select__dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ct-custom-select__dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Options */
.ct-custom-select__option {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--ct-text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-custom-select__option:hover {
    background: var(--ct-bg);
    color: var(--ct-primary);
}

.ct-custom-select__option.selected {
    background: #eff6ff;
    color: var(--ct-primary);
    font-weight: 600;
}

.ct-custom-select__option.disabled {
    color: var(--ct-muted);
    cursor: not-allowed;
    font-style: italic;
}

.ct-custom-select__option.disabled:hover {
    background: transparent;
    color: var(--ct-muted);
}

/* ══════════════════════════════════════════════════════════════════════
   Card Title Display (card_image.php - Front-end Display)
══════════════════════════════════════════════════════════════════════ */
.ct-card-value {
    margin: 0;
    padding: 14px 18px 14px 22px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ct-text);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ct-card-value::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--ct-accent) 0%, #d4890a 100%);
    border-radius: 2px 0 0 2px;
}

/* Card Image Display */
.ct-card-image {
    display: block;
    width: 100%;
    max-width: 320px;
    /* height: auto; */
    border-radius: var(--ct-radius-sm);
    box-shadow: var(--ct-shadow);
    transition: box-shadow var(--ct-transition), transform var(--ct-transition);
    max-height: 200px;
}

.ct-card-image:hover {
    box-shadow: var(--ct-shadow-hover);
    transform: translateY(-2px) scale(1.02);
}