/**
 * GSV Return Equipment — stylesheet
 *
 * Class names are kept identical to the original React app's SCSS so that
 * any shared theme styles that already target these selectors continue to work.
 * Only plugin-specific layout and component styles are defined here.
 *
 * Prefix: .gsv-return-equipment-wrap scopes all rules to the shortcode output.
 */

/* ==========================================================================
   Wrap
   ========================================================================== */

.gsv-return-equipment-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    padding: 0 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   Loader
   ========================================================================== */

.app-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.gsv-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(0, 0, 0, 0.12);
    border-top-color: #005b38;
    border-radius: 50%;
    animation: gsv-spin 0.75s linear infinite;
}

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

.gsv-loader-msg {
    margin-top: 16px;
    font-size: 1rem;
    color: #444;
}

/* ==========================================================================
   Error page
   ========================================================================== */

.app-error-page {
    padding: 20px 24px;
    text-align: center;
}

.app-error-page h2 {
    margin-bottom: 12px;
}

.app-error-page p {
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ==========================================================================
   Material overview — two-column layout
   ========================================================================== */

.app-material-return {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

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

    .app-material-return__column--info {
        text-align: center;
    }

    .app-material-return__column--info .app-material-detail__item {
        justify-content: center;
        gap: 8px;
    }

    .app-material-return__column--info .btn {
        display: block;
        width: 100%;
    }
}

.app-material-return__head {
    margin-bottom: 24px;
}

.app-material-return__product-image img.gsv-product-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.gsv-product-image--placeholder {
    width: 100%;
    padding-bottom: 52.8%; /* 615:326 ratio */
    background: #e9e9e9;
    border-radius: 4px;
}

/* ==========================================================================
   Material detail blocks
   ========================================================================== */

.app-material-detail {
    margin-bottom: 12px;
}

.app-material-detail--border {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
    margin-top: 12px;
}

.app-material-detail--spacing-bigger {
    margin-bottom: 20px;
}

.app-material-detail__heading {
    margin-bottom: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.app-material-detail__title {
    margin: 6px 0 10px;
}

.app-material-detail__item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.95rem;
}

/* ==========================================================================
   Material ID tag
   ========================================================================== */

.app-material-id {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 4px;
}

.app-material-id--bold {
    color: #333;
}

/* ==========================================================================
   Status badge
   ========================================================================== */

.gsv-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 400;
    background: #e8f5e9;
    color: #2e7d32;
    margin: 6px 0 4px;
}

.app-material-startdate {
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 12px;
}

/* Map action buttons (toggle + reset) — always left-aligned */
.gsv-map-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* ==========================================================================
   Map
   ========================================================================== */

.app-google-map {
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.app-map-marker {
    display: block;
    width: 14px;
    height: 14px;
    background: rgba(0, 91, 56, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* ==========================================================================
   Return modal overlay
   ========================================================================== */

.app-return-material-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 16px;
}

.app-return-material-modal-content {
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 960px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: gsv-fade-in 0.22s ease-out;
}

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

/* ==========================================================================
   Return form steps
   ========================================================================== */

.app-material-return-step {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.app-material-return-step.step-two,
.app-material-return-step.return-step-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.app-material-return-step.step-two .app-material-return-step__column,
.app-material-return-step.return-step-error .app-material-return-step__column {
    width: 100%;
    max-width: 560px;
}

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

.app-material-return-step__info {
    margin-bottom: 16px;
}

.app-material-return-step__info h2 {
    margin-bottom: 8px;
}

.app-material-return-step__input {
    display: flex;
    flex-direction: column;
}

.app-material-return-step__input input[type="text"],
.app-material-return-step__input input[type="datetime-local"],
.app-material-return-step__input textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    background: #fafafa;
    transition: border-color 0.15s;
}

.app-material-return-step__input input:focus,
.app-material-return-step__input textarea:focus {
    outline: none;
    border-color: #005b38;
    background: #fff;
}

.app-material-return-step__address p {
    margin: 4px 0 0;
    line-height: 1.5;
}

.app-material-return-step__map {
    margin-bottom: 16px;
}

.app-material-return-step__date-picker {
    margin-bottom: 16px;
}

.app-material-return-step__error {
    text-align: center;
    padding: 24px 0;
}

.app-material-return-step__error-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Checkbox (custom styled, matches React app's .cbx)
   ========================================================================== */

.inp-cbx {
    display: none;
}

.cbx {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}

.cbx span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #bbb;
    border-radius: 3px;
    background: #fff;
    transition:
        border-color 0.15s,
        background 0.15s;
}

.cbx span:first-child svg {
    display: none;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

.inp-cbx:checked + .cbx span:first-child {
    background: #005b38;
    border-color: #005b38;
}

.inp-cbx:checked + .cbx span:first-child svg {
    display: block;
}

/* ==========================================================================
   Material preview panel (return form sidebar)
   ========================================================================== */

.app-material-return-preview {
    padding: 0;
}

.app-material-return-preview__material {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 8px 0;
}

.app-material-return-preview__image {
    width: 80px;
    height: 48px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.app-material-return-preview__details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-material-return-preview__details h4 {
    margin: 0;
    font-size: 0.9rem;
}

/* ==========================================================================
   Already-returned / success screens
   ========================================================================== */

.app-material-returned {
    display: flex;
    justify-content: center;
    padding: 40px 16px;
}

.app-material-returned__container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 540px;
    width: 100%;
    gap: 20px;
}

/* ==========================================================================
   Return icon (success / error)
   ========================================================================== */

.app-return-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 4px;
}

.app-return-icon--successful {
    color: #005b38;
    background: #e8f5e9;
}

.app-return-icon--error {
    color: #c62828;
    background: #fdecea;
}

.gsv-icon-svg {
    width: 40px;
    height: 40px;
}

/* ==========================================================================
   Material card (used in already-returned screen)
   ========================================================================== */

.gsv-material-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    width: 100%;
    text-align: left;
}

.gsv-material-card__image {
    width: 80px;
    height: 48px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.gsv-material-card__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.9rem;
}

/* ==========================================================================
   DAWA address autocomplete dropdown
   ========================================================================== */

.app-location-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-location-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-location-list li {
    padding: 9px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}

.app-location-list li:last-child {
    border-bottom: none;
}

.app-location-list li:hover {
    background: #f5f5f5;
}

/* ==========================================================================
   Labels & utility classes (mirrors theme's l- utility classes)
   ========================================================================== */

.l-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 4px;
}

.l-link {
    color: #005b38;
    text-decoration: underline;
    cursor: pointer;
}

.l-title-tag {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
}

.l-warning {
    display: block;
    color: #b26a00;
    font-size: 0.82rem;
}

.c-error {
    color: #c62828;
}

.mb-0 {
    margin-bottom: 0 !important;
}
.mb-1 {
    margin-bottom: 8px !important;
}
.mb-2 {
    margin-bottom: 16px !important;
}
.mb-3 {
    margin-bottom: 24px !important;
}
.mt-1 {
    margin-top: 8px !important;
}
.mt-2 {
    margin-top: 16px !important;
}
.mr-0 {
    margin-right: 0 !important;
}
.ml-0 {
    margin-left: 0 !important;
}

/* ==========================================================================
   Buttons (scoped fallbacks — defer to theme if present)
   ========================================================================== */

.gsv-return-equipment-wrap .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: 2px solid transparent;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
    line-height: 1.2;
}

.gsv-return-equipment-wrap .btn--primary {
    background: #005b38;
    color: #fff;
    border-color: #005b38;
}

.gsv-return-equipment-wrap .btn--primary:hover:not(:disabled) {
    background: #004429;
    border-color: #004429;
}

.gsv-return-equipment-wrap .btn--primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gsv-return-equipment-wrap .btn--secondary {
    background: transparent;
    color: #005b38;
    border-color: #005b38;
}

.gsv-return-equipment-wrap .btn--secondary:hover {
    background: #005b38;
    color: #fff;
}

.gsv-return-equipment-wrap .btn--link,
.gsv-return-equipment-wrap .btn--link-underline {
    background: none;
    border: none;
    padding: 0;
    color: #005b38;
    text-decoration: underline;
    font-weight: 400;
    cursor: pointer;
}

.gsv-return-equipment-wrap .btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gsv-return-equipment-wrap .l-link.mb-2 {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-block;
}

/* ==========================================================================
   Page header — logo bar
   ========================================================================== */

.return-equipment-header {
    display: flex;
    justify-content: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 12px;
}

.return-equipment-header a {
    display: block;
    line-height: 0;
}

.return-equipment-header svg {
    width: 128px;
    height: auto;
}
