/**
 * Elállási Jog Plugin – Frontend Styles
 * Uses CSS custom properties set inline by PHP.
 */

/* ── Root / Container ───────────────────────────── */
#elallas-app {
    --el-primary:    #2271b1;
    --el-secondary:  #f6f7f7;
    --el-text:       #1d2327;
    --el-button:     #2271b1;
    --el-radius:     6px;
    --el-btn-radius: 6px;
    --el-shadow:     0 2px 8px rgba(0,0,0,.08);

    font-family: inherit;
    color: var(--el-text);
    font-size: 15.5px;
    line-height: 1.55;
    max-width: 780px;
    margin: 0 auto;
}

/* ── Steps ──────────────────────────────────────── */
.elallas-step {
    animation: el-fade-in .25s ease;
}

@keyframes el-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Heading ────────────────────────────────────── */
.elallas-heading {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--el-primary);
    border-bottom: 2px solid var(--el-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* ── Notice / Info ──────────────────────────────── */
.elallas-notice {
    background: #e8f0fe;
    border-left: 4px solid var(--el-primary);
    padding: 12px 16px;
    border-radius: 0 var(--el-radius) var(--el-radius) 0;
    margin-bottom: 20px;
    font-size: 1rem;
}

.elallas-info-box {
    background: var(--el-secondary);
    border-radius: var(--el-radius);
    padding: 24px;
    text-align: center;
}

.elallas-info-box h3 {
    color: var(--el-primary);
    margin-bottom: 10px;
}

/* ── Order Cards ────────────────────────────────── */
.elallas-orders-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.elallas-order-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: var(--el-radius);
    padding: 18px 20px;
    box-shadow: var(--el-shadow);
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.elallas-order-card:hover,
.elallas-order-card.el-selected {
    border-color: var(--el-primary);
    box-shadow: 0 0 0 2px var(--el-primary);
}

.el-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.el-order-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--el-primary);
}

.el-order-deadline {
    font-size: .85rem;
    background: #fff3cd;
    color: #664d03;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.el-order-meta {
    display: flex;
    gap: 20px;
    font-size: .95rem;
    color: #555;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.el-order-items {
    font-size: .95rem;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.el-order-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.el-non-returnable-notice {
    font-size: .9rem;
    color: #9b2c2c;
    background: #fff5f5;
    border-left: 3px solid #fc8181;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    margin-top: 6px;
}

.el-select-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    text-align: center;
    background: var(--el-secondary);
    border: 1px solid var(--el-primary);
    border-radius: var(--el-btn-radius);
    color: var(--el-primary);
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: background .2s;
}

.el-select-btn:hover,
.elallas-order-card.el-selected .el-select-btn {
    background: var(--el-primary);
    color: #fff;
}

/* ── Type selection ─────────────────────────────── */
.elallas-type-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .elallas-type-options { grid-template-columns: 1fr; }
}

.elallas-type-card {
    border: 2px solid #e2e4e7;
    border-radius: var(--el-radius);
    padding: 18px 16px;
    cursor: pointer;
    display: block;
    transition: border-color .2s;
}

.elallas-type-card input[type="radio"] {
    display: none;
}

.elallas-type-card:has(input:checked),
.elallas-type-card.el-type-active {
    border-color: var(--el-primary);
    background: rgba(34,113,177,.04);
}

.elallas-type-title {
    display: block;
    font-weight: 700;
    font-size: 1.08rem;
    margin-bottom: 6px;
}

.elallas-type-desc {
    display: block;
    font-size: .95rem;
    color: #666;
}

/* ── Items selection ────────────────────────────── */
#el-items-selection {
    background: var(--el-secondary);
    border-radius: var(--el-radius);
    padding: 16px;
    margin-bottom: 20px;
}

#el-items-selection h4 {
    margin: 0 0 12px;
    font-weight: 600;
}

.el-item-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e4e7;
}

.el-item-checkbox:last-child {
    border-bottom: none;
}

.el-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--el-primary);
}

.el-item-label {
    flex: 1;
    font-size: 1rem;
}

.el-item-qty {
    font-size: .88rem;
    color: #888;
}

.el-item-price {
    font-weight: 600;
    min-width: 80px;
    text-align: right;
}

.el-item-non-returnable {
    opacity: .5;
    cursor: not-allowed;
}

.el-item-non-returnable .el-item-label::after {
    content: " ⚠️";
    font-size: .85rem;
    color: #e65100;
}

/* ── Reason field ───────────────────────────────── */
.elallas-reason-field {
    margin-bottom: 20px;
}

.elallas-reason-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 1rem;
}

.elallas-reason-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccd0d4;
    border-radius: var(--el-radius);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color .2s;
}

.elallas-reason-field textarea:focus {
    border-color: var(--el-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.2);
}

/* ── Summary ────────────────────────────────────── */
.elallas-summary-box {
    background: var(--el-secondary);
    border-radius: var(--el-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.el-summary-row {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

.el-summary-label {
    font-weight: 600;
    min-width: 180px;
    font-size: 1rem;
}

.el-summary-value {
    font-size: 1rem;
}

.el-summary-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.el-summary-items-table th,
.el-summary-items-table td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid #ddd;
    font-size: .95rem;
}

.el-summary-items-table th {
    background: rgba(0,0,0,.04);
    font-weight: 600;
}

.elallas-legal-notice {
    font-size: .92rem;
    color: #666;
    margin-bottom: 20px;
}

/* ── Actions ────────────────────────────────────── */
.elallas-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.elallas-btn {
    padding: 10px 22px;
    border-radius: var(--el-btn-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.elallas-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.elallas-btn-primary {
    background: var(--el-button);
    color: #fff;
    border-color: var(--el-button);
}

.elallas-btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.elallas-btn-outline {
    background: transparent;
    color: var(--el-primary);
    border-color: var(--el-primary);
}

.elallas-btn-outline:hover:not(:disabled) {
    background: var(--el-primary);
    color: #fff;
}

.elallas-btn-danger {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.elallas-btn-danger:hover:not(:disabled) {
    background: #a93226;
    border-color: #a93226;
}

/* ── Form fields (guest flow) ───────────────────── */
.elallas-form-group {
    margin-bottom: 20px;
}

.elallas-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.elallas-input {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    border: 1px solid #ccd0d4;
    border-radius: var(--el-radius);
    padding: 10px 14px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .2s;
}

.elallas-input:focus {
    border-color: var(--el-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.2);
}

.elallas-code-input {
    max-width: 120px;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.elallas-hint {
    font-size: .92rem;
    color: #666;
    margin-top: 12px;
}

.elallas-hint a {
    color: var(--el-primary);
}

/* ── Success ────────────────────────────────────── */
.elallas-success-box {
    text-align: center;
    padding: 40px 20px;
}

.elallas-success-icon {
    width: 64px;
    height: 64px;
    background: #c6f6d5;
    color: #276749;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
}

.elallas-success-box h3 {
    font-size: 1.4rem;
    color: #276749;
    margin-bottom: 12px;
}

.elallas-legal-info {
    font-size: .88rem;
    color: #888;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

/* ── Error / Loading ────────────────────────────── */
.elallas-error-box {
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: var(--el-radius);
    padding: 14px 16px;
    margin-top: 16px;
    color: #c53030;
}

.elallas-loading {
    color: #888;
    font-style: italic;
}

/* ── Spinner ────────────────────────────────────── */
.el-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: el-spin .7s linear infinite;
    vertical-align: middle;
}

@keyframes el-spin {
    to { transform: rotate(360deg); }
}

/* ── v1.0.3 additions: choice cards, star, declaration, spam note ── */

.elallas-choice-card {
    border: 2px solid #e2e4e7;
    border-radius: var(--el-radius);
    padding: 18px 16px;
    cursor: pointer;
    display: block;
    text-align: left;
    background: #fff;
    transition: border-color .2s, background .2s;
    width: 100%;
}
.elallas-choice-card:hover {
    border-color: var(--el-primary);
    background: rgba(34,113,177,.04);
}

.el-star {
    color: #c0392b;
    font-weight: 700;
}

.el-order-item.el-grey,
.el-item-non-returnable {
    color: #999;
    background: #f7f7f7;
}

.elallas-spam-note {
    background: #fff8e1;
    border-left: 4px solid #f0ad00;
    padding: 10px 14px;
    border-radius: 0 var(--el-radius) var(--el-radius) 0;
    font-size: .95rem;
    margin-bottom: 16px;
}

.elallas-declaration {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--el-secondary);
    border-radius: var(--el-radius);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.5;
    cursor: pointer;
}
.elallas-declaration input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--el-primary);
    cursor: pointer;
}

.elallas-link-btn {
    background: none;
    border: none;
    color: var(--el-primary);
    cursor: pointer;
    text-decoration: underline;
    font-size: .95rem;
    padding: 0;
}
.elallas-link-btn:disabled {
    color: #999;
    cursor: default;
    text-decoration: none;
}

/* ── v1.0.5: fully non-returnable order (perishable only) ── */
.el-order-locked {
    cursor: default;
    border-color: #e2e4e7;
}
.el-order-locked:hover {
    box-shadow: var(--el-shadow);
    border-color: #e2e4e7;
}
.el-legal-block {
    background: #fff5f5;
    border-left: 4px solid #c0392b;
    padding: 12px 14px;
    border-radius: 0 var(--el-radius) var(--el-radius) 0;
    margin: 10px 0;
    font-size: .92rem;
    line-height: 1.5;
    color: #742a2a;
}
.el-select-btn:disabled {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #999;
    cursor: not-allowed;
}
.el-select-btn:disabled:hover {
    background: #f0f0f0;
    color: #999;
}

/* ── v1.0.7: per-line quantity picker in partial withdrawal ── */
.el-item-qtypick {
    font-size: .9rem;
    color: #444;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.el-item-wq {
    width: 52px;
    padding: 3px 6px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    font-size: .92rem;
    text-align: center;
}
.el-item-wq:focus {
    border-color: var(--el-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.2);
}

/* ── v1.0.9: modification page order actions ── */
.el-order-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.el-order-actions .elallas-btn {
    flex: 1;
    min-width: 130px;
    justify-content: center;
}

/* ── Account overview box (My Account) ── */
.elallas-overview-box {
    font-size: 15.5px;
    line-height: 1.55;
}
.elallas-overview-row {
    font-size: .98rem;
}
.elallas-overview-row .el-order-number {
    font-size: 1.05rem;
}
.elallas-overview-row a {
    font-size: .98rem;
}
.elallas-badge {
    font-size: 13px !important;
}

/* ─────────────────────────────────────────────────────────
 * 1.4.1 – polished, unified order design (account + standalone)
 * ───────────────────────────────────────────────────────── */

/* Turn the flat order list into a responsive card grid. */
.elallas-orders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
@media (max-width: 620px) {
    .elallas-orders-list { grid-template-columns: 1fr; }
}

/* Card lift + accent bar. */
.elallas-order-card {
    position: relative;
    overflow: hidden;
}
.elallas-order-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--el-primary);
    opacity: .0;
    transition: opacity .2s;
}
.elallas-order-card:hover { transform: translateY(-2px); }
.elallas-order-card:hover::before,
.elallas-order-card.el-selected::before { opacity: 1; }

.elallas-order-card.el-order-locked { opacity: .82; }

/* Mandatory legal declaration block on the summary step. */
.el-decl-block {
    background: #fff;
    border: 1px solid var(--el-primary);
    border-left: 4px solid var(--el-primary);
    border-radius: var(--el-radius);
    padding: 14px 16px 6px;
    margin-bottom: 16px;
}
.el-decl-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--el-primary);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
}
.el-decl-block .el-summary-row:last-child { border-bottom: none; }

/* ─────────────────────────────────────────────────────────
 * 1.4.2 – warnings, deadlines, "only once" notes
 * ───────────────────────────────────────────────────────── */

/* Open-ended deadline chip (withdrawal available continuously). */
.el-order-deadline.el-deadline-open {
    background: #e7f0fb;
    color: #1c5fa8;
}

/* "Return is the customer's responsibility" warning on the withdrawal summary. */
.el-return-warn {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fff4e5;
    border: 1px solid #f0c37a;
    border-left: 4px solid #e08a00;
    border-radius: 8px;
    font-size: .95rem;
    color: #5c4300;
    line-height: 1.5;
}

/* "Modification is possible only once" note. */
.el-modify-once-note {
    margin: 10px 0;
    padding: 9px 12px;
    background: #fff8e5;
    border-radius: 8px;
    font-size: .9rem;
    color: #6a5200;
    line-height: 1.45;
}

/* Stronger legal block for forbidden-only orders. */
.el-legal-block {
    background: #fdf0f0;
    border: 1px solid #f1b0b0;
    border-left: 4px solid #d63638;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 10px 0;
    font-size: .92rem;
    color: #7a1f1f;
    line-height: 1.5;
}

/* Per-item forbidden notice (some items non-returnable). */
.el-non-returnable-notice {
    margin-top: 8px;
    padding: 9px 12px;
    background: #fff5f5;
    border-left: 3px solid #fc8181;
    border-radius: 0 6px 6px 0;
    font-size: .88rem;
    color: #7a2727;
    line-height: 1.45;
}

/* ── Mobile: comfortable touch targets, no edge-to-edge cramping ── */
@media (max-width: 600px) {
    #elallas-app { font-size: 15px; }
    .elallas-heading { font-size: 1.2rem; }
    .elallas-btn { padding: 12px 20px; width: 100%; justify-content: center; }
    .elallas-actions { flex-direction: column; align-items: stretch; }
    .elallas-order-card { padding: 14px 16px; }
    .el-order-meta { gap: 10px; }
    .elallas-summary-box,
    .elallas-info-box { padding: 16px; }
}
