/**
 * Components CSS - Postrzelam.pl
 * Swiper overrides, Leaflet overrides, forms, modals
 *
 * @package Postrzelam
 */

/* ==========================================================================
   Swiper Overrides
   ========================================================================== */

.pstr-swiper {
    width: 100%;
    padding-bottom: 48px;
}

.pstr-swiper .swiper-slide {
    height: auto;
}

.pstr-swiper .swiper-pagination {
    bottom: 0;
}

.pstr-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: var(--pstr-border);
    opacity: 1;
    transition: background-color var(--pstr-transition), transform var(--pstr-transition);
}

.pstr-swiper .swiper-pagination-bullet-active {
    background-color: var(--pstr-red);
    transform: scale(1.2);
}

.pstr-swiper .swiper-button-next,
.pstr-swiper .swiper-button-prev {
    width: 48px;
    height: 48px;
    background-color: var(--pstr-white);
    border: 2px solid var(--pstr-border);
    border-radius: 50%;
    color: var(--pstr-black);
    transition: border-color var(--pstr-transition), color var(--pstr-transition);
}

.pstr-swiper .swiper-button-next:hover,
.pstr-swiper .swiper-button-prev:hover {
    border-color: var(--pstr-red);
    color: var(--pstr-red);
}

.pstr-swiper .swiper-button-next::after,
.pstr-swiper .swiper-button-prev::after {
    font-size: 16px;
    font-weight: 700;
}

/* ==========================================================================
   Leaflet Map Overrides
   ========================================================================== */

.pstr-map-container {
    width: 100%;
    height: 400px;
    border-radius: var(--pstr-radius-lg);
    overflow: hidden;
    border: 2px solid var(--pstr-border);
}

@media (min-width: 768px) {
    .pstr-map-container {
        height: 500px;
    }
}

@media (min-width: 1024px) {
    .pstr-map-container {
        height: 600px;
    }
}

.pstr-map-container .leaflet-popup-content-wrapper {
    border-radius: var(--pstr-radius);
    box-shadow: var(--pstr-shadow-md);
    padding: 0;
}

.pstr-map-container .leaflet-popup-content {
    margin: 0;
    font-family: var(--pstr-font-body);
    font-size: 0.9375rem;
    line-height: 1.5;
    min-width: 200px;
}

.pstr-map-popup {
    padding: var(--pstr-space-md);
}

.pstr-map-popup h4 {
    font-family: var(--pstr-font-heading);
    font-weight: var(--pstr-fw-bold);
    font-size: 1rem;
    margin-bottom: var(--pstr-space-xs);
    text-transform: uppercase;
}

.pstr-map-popup p {
    color: var(--pstr-gray-dark);
    font-size: 0.875rem;
    margin-bottom: var(--pstr-space-sm);
}

.pstr-map-popup .pstr-btn {
    width: 100%;
}

.pstr-map-container .leaflet-popup-close-button {
    width: 32px;
    height: 32px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pstr-map-container .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 18px;
    border-radius: var(--pstr-radius-sm);
}

/* Custom Map Marker */
.pstr-map-marker {
    background-color: var(--pstr-red);
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid var(--pstr-white);
    box-shadow: var(--pstr-shadow-sm);
}

/* ==========================================================================
   Form Styles (Extended)
   ========================================================================== */

.pstr-form {
    max-width: 600px;
    margin: 0 auto;
}

.pstr-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--pstr-space-md);
}

@media (min-width: 768px) {
    .pstr-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.pstr-form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--pstr-space-sm);
    cursor: pointer;
    min-height: 48px;
    padding: var(--pstr-space-sm) 0;
}

.pstr-form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--pstr-red);
}

.pstr-form-checkbox span {
    font-size: 0.9375rem;
    color: var(--pstr-gray-dark);
    line-height: 1.5;
}

.pstr-form-message {
    padding: var(--pstr-space-md);
    border-radius: var(--pstr-radius);
    margin-bottom: var(--pstr-space-md);
    font-size: 0.9375rem;
}

.pstr-form-message--success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.pstr-form-message--error {
    background-color: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

/* Star Rating Input */
.pstr-star-input {
    display: flex;
    gap: 4px;
    direction: rtl;
}

.pstr-star-input input {
    display: none;
}

.pstr-star-input label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #E0E0E0;
    transition: color var(--pstr-transition);
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pstr-star-input label:hover,
.pstr-star-input label:hover ~ label,
.pstr-star-input input:checked ~ label {
    color: #FFB800;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.pstr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--pstr-overlay);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--pstr-space-md);
    opacity: 0;
    transition: opacity var(--pstr-transition);
}

.pstr-modal-overlay.is-active {
    display: flex;
    opacity: 1;
}

.pstr-modal {
    background-color: var(--pstr-white);
    border-radius: var(--pstr-radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform var(--pstr-transition);
}

.pstr-modal-overlay.is-active .pstr-modal {
    transform: translateY(0);
}

.pstr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--pstr-space-lg);
    border-bottom: 1px solid var(--pstr-border);
}

.pstr-modal-header h3 {
    margin: 0;
}

.pstr-modal-close {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--pstr-gray-dark);
    border-radius: var(--pstr-radius);
    transition: background-color var(--pstr-transition);
}

.pstr-modal-close:hover {
    background-color: var(--pstr-gray);
}

.pstr-modal-body {
    padding: var(--pstr-space-lg);
}

.pstr-modal-footer {
    display: flex;
    gap: var(--pstr-space-sm);
    justify-content: flex-end;
    padding: var(--pstr-space-lg);
    border-top: 1px solid var(--pstr-border);
}

/* ==========================================================================
   Tags
   ========================================================================== */

.pstr-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pstr-space-sm);
}

.pstr-tags a,
.pstr-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-family: var(--pstr-font-heading);
    font-weight: var(--pstr-fw-semibold);
    text-transform: uppercase;
    color: var(--pstr-gray-dark);
    background-color: var(--pstr-gray);
    border-radius: var(--pstr-radius-full);
    transition: background-color var(--pstr-transition), color var(--pstr-transition);
    min-height: 36px;
}

.pstr-tags a:hover,
.pstr-tag:hover {
    background-color: var(--pstr-red-light);
    color: var(--pstr-red);
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.pstr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--pstr-border);
    border-top-color: var(--pstr-red);
    border-radius: 50%;
    animation: pstr-spin 0.7s linear infinite;
    margin: var(--pstr-space-xl) auto;
}

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

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */

.pstr-skeleton {
    background: linear-gradient(90deg, var(--pstr-gray) 25%, #ECECEC 50%, var(--pstr-gray) 75%);
    background-size: 200% 100%;
    animation: pstr-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--pstr-radius-sm);
}

@keyframes pstr-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pstr-skeleton-text {
    height: 16px;
    margin-bottom: var(--pstr-space-sm);
    width: 100%;
}

.pstr-skeleton-text:last-child {
    width: 60%;
}

.pstr-skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 10;
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.pstr-tooltip {
    position: relative;
}

.pstr-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background-color: var(--pstr-black);
    color: var(--pstr-white);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: var(--pstr-radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pstr-transition);
}

.pstr-tooltip:hover::after {
    opacity: 1;
}
