/**
 * EFT Suite Generator — WordPress Admin Styles
 *
 * Matches WordPress admin aesthetics — NOT the EFTSuite dark theme.
 *
 * @package WP_EFT
 */

/* ── Overlay ──────────────────────────────────── */
.ws-modal-wrap {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,.75) !important;
    z-index: 100000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ws-modal {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,.3);
    width: 95%;
    max-width: 1080px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1d2327;
    font-size: 13px;
}

/* ── Header ───────────────────────────────────── */
.ws-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #c3c4c7;
    background: #fff;
    flex-shrink: 0;
}

.ws-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.ws-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8c8f94;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.ws-close:hover {
    color: #1d2327;
}

/* ── Progress Bar ─────────────────────────────── */
.ws-progress {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.ws-progress::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 30px;
    right: 30px;
    height: 2px;
    background: #c3c4c7;
    z-index: 0;
}

.ws-progress li {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c3c4c7;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: background .2s;
    cursor: default;
}

.ws-progress li.completed {
    background: #00a32a;
}

.ws-progress li.active {
    background: #2271b1;
}

/* ── Body ─────────────────────────────────────── */
.ws-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ws-step {
    display: none;
}

.ws-step-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #1d2327;
}

/* ── Footer ───────────────────────────────────── */
.ws-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #c3c4c7;
    background: #f6f7f7;
    flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────── */
.ws-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border: 1px solid #2271b1;
    border-radius: 4px;
    background: #2271b1;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.ws-btn:hover, .ws-btn:focus {
    background: #135e96;
    border-color: #135e96;
    outline: none;
}

.ws-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.ws-btn-secondary {
    background: #f6f7f7;
    color: #2271b1;
    border-color: #2271b1;
}

.ws-btn-secondary:hover {
    background: #f0f0f1;
}

.ws-btn-danger {
    border-color: #d63638;
    background: #d63638;
    color: #fff;
}

.ws-btn-danger:hover {
    background: #b92b2d;
    border-color: #b92b2d;
}

.ws-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* ── Upload / Drop Zone ───────────────────────── */
.ws-dropzone {
    border: 2px dashed #8c8f94;
    border-radius: 6px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.ws-dropzone:hover,
.ws-dropzone.dragover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ws-uploaded {
    border-color: #00a32a !important;
    background: #f0fff4 !important;
}

.ws-preview {
    margin: 16px 0;
}

.ws-preview img {
    max-width: 100%;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

/* ── Warnings / Alerts ────────────────────────── */
.ws-warning {
    background: #fcf8e3;
    border: 1px solid #faebcc;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 12px 0;
    color: #8a6d3b;
    font-size: 13px;
}

.ws-success {
    background: #f0fff4;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 12px 0;
    color: #155724;
}

.ws-error-msg {
    color: #d63638;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

/* ── Canvas ───────────────────────────────────── */
.ws-canvas-wrap {
    position: relative;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.ws-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #c3c4c7;
}

.ws-rotate-btns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
}

.ws-rotate-btns button {
    padding: 6px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    color: #1d2327;
    cursor: pointer;
    font-size: 13px;
}

.ws-rotate-btns button:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
}

/* ── Mode Cards ───────────────────────────────── */
.ws-mode-cards {
    display: flex;
    gap: 16px;
    margin: 20px 0;
}

.ws-mode-card {
    flex: 1;
    border: 2px solid #c3c4c7;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.ws-mode-card:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34,113,177,.15);
}

.ws-mode-card.ws-selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ws-mode-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.ws-mode-card p {
    margin: 0;
    font-size: 13px;
    color: #646970;
}

/* ── Box Selection Sidebar ────────────────────── */
.ws-box-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.ws-box-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.ws-box-list li {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}

.ws-box-list li:hover {
    background: #f9f9f9;
}

.ws-box-list li.active {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ws-box-list li.placed {
    opacity: .6;
}

.ws-box-list li.inactive {
    opacity: .45;
    text-decoration: line-through;
}

.ws-box-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.ws-box-dot.on {
    background: #2271b1;
}

.ws-box-dot.off {
    background: #c3c4c7;
}

.ws-box-label {
    flex: 1;
}

.ws-box-toggle {
    display: inline-flex;
    align-items: center;
}

.ws-box-toggle input {
    margin: 0;
}

.ws-box-tools {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ws-box-tools button {
    padding: 4px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
}

.ws-box-tools button:hover {
    background: #f0f0f1;
}

/* ── Demographics Form ────────────────────────── */
.ws-pii-layout {
    display: flex;
    gap: 24px;
}

.ws-pii-fields {
    flex: 1;
}

.ws-field {
    margin-bottom: 12px;
}

.ws-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #1d2327;
}

.ws-req {
    color: #d63638;
    margin-left: 2px;
}

.ws-field input,
.ws-field select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
    color: #1d2327;
    transition: border-color .15s, box-shadow .15s;
}

.ws-field input:focus,
.ws-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.ws-field input.ws-error,
.ws-field select.ws-error {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

/* ── Review ───────────────────────────────────── */
.ws-review-section {
    margin-bottom: 20px;
}

.ws-review-section h4 {
    margin: 0 0 8px;
    font-size: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.ws-review-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 6px 12px;
    font-size: 13px;
}

.ws-review-grid dt {
    font-weight: 500;
    color: #646970;
}

.ws-review-grid dd {
    margin: 0;
    color: #1d2327;
}

/* ── Download ─────────────────────────────────── */
.ws-download {
    text-align: center;
    padding: 30px 0;
}

.ws-dl-icon {
    font-size: 56px;
    color: #00a32a;
    margin-bottom: 12px;
}

.ws-download h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.ws-download p {
    margin: 0 0 20px;
    color: #646970;
}

/* ── Spinner ──────────────────────────────────── */
.ws-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #c3c4c7;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ws-spin .6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes ws-spin {
    to { transform: rotate(360deg); }
}

/* ── Utilities ────────────────────────────────── */
.ws-center { text-align: center; }
.ws-mb { margin-bottom: 12px; }
.ws-mt { margin-top: 12px; }
.ws-flex { display: flex; gap: 8px; }
.ws-flex > * { flex: 1; }


/* ── Layout Updates & Responsive Media Queries ── */
.ws-progress-wrap {
    padding: 0 20px;
}

.ws-box-layout {
    display: flex;
    gap: 16px;
}

.ws-box-mobile-select-wrap {
    display: none;
}

.ws-review-layout {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.ws-review-canvas-wrap {
    flex: 0 0 400px;
}

@media (max-width: 768px) {
    /* Modal container adjustments for mobile — absolute full screen */
    .ws-modal-wrap {
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
    }
    
    .ws-modal {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    /* Layout ordering on mobile: header -> navigation -> progress bar -> body */
    .ws-header {
        order: 1 !important;
    }
    
    .ws-footer {
        order: 3 !important;
        border-top: 1px solid #c3c4c7 !important;
        border-bottom: 1px solid #c3c4c7 !important;
        background: #f6f7f7 !important;
        padding: 8px 12px !important;
    }
    
    .ws-progress-wrap {
        order: 2 !important;
        padding: 0 12px !important;
    }
    
    .ws-body {
        order: 4 !important;
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 12px !important;
    }
    
    /* Progress bar adjustments */
    .ws-progress {
        padding: 8px 0 !important;
    }
    
    .ws-progress::before {
        top: 21px !important;
        left: 15px !important;
        right: 15px !important;
    }
    
    .ws-progress li {
        width: 20px !important;
        height: 20px !important;
        font-size: 10px !important;
    }
    
    /* Step 3: Finger placement layout */
    .ws-box-layout {
        flex-direction: column !important;
    }
    
    .ws-box-sidebar {
        display: none !important;
    }
    
    .ws-box-mobile-select-wrap {
        display: block !important;
        margin-top: 12px !important;
    }
    
    .ws-box-dropdown {
        width: 100% !important;
        padding: 8px 12px !important;
        border: 1px solid #8c8f94 !important;
        border-radius: 4px !important;
        font-size: 14px !important;
        background-color: #fff !important;
        color: #1d2327 !important;
    }
    
    /* Step 4: Demographics form layout */
    .ws-pii-layout {
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    .ws-pii-fields {
        margin-bottom: 8px !important;
    }
    
    /* Step 5: Review step layout */
    .ws-review-layout {
        flex-direction: column-reverse !important;
        gap: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .ws-review-canvas-wrap {
        flex: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Canvas styling on mobile - fit the width of the screen cleanly without horizontal scroll issues */
    .ws-canvas-wrap {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .ws-canvas-wrap canvas#ws-canvas,
    .ws-canvas-wrap canvas#ws-box-canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }
}
