/* ============================================
   🎨 BasicRECMS Components
   Specific UI components for admin interface
   ============================================ */

/* === Property Card Variants === */
.property-card-image,
.property-card-image-placeholder {
    width: 100%;
    height: 220px;
}

.property-card-image {
    object-fit: cover;
    display: block;
}

.property-card-image-placeholder {
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary) / 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: hsl(var(--primary-foreground));
}

.property-card-content {
    padding: var(--space-4);
}

.property-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: hsl(var(--foreground));
    text-decoration: none;
    display: block;
    line-height: 1.4;
    transition: color var(--transition-fast);
}

.property-card-title:hover {
    color: hsl(var(--primary));
}

.property-card-meta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
    align-items: center;
    font-size: var(--text-sm);
}

.property-type {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: hsl(var(--muted-foreground));
}

.property-card-price {
    font-size: var(--text-xl);
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-bottom: var(--space-4);
}

.property-card-actions {
    display: flex;
    gap: var(--space-2);
}

/* === Property Details === */
.property-detail {
    max-width: 1200px;
    margin: 0 auto;
}

.property-header {
    margin-bottom: var(--space-8);
}

.property-gallery {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-8);
}

.property-main-image {
    width: 100%;
    height: 500px;
    object-fit: cover;
}

.property-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.property-thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition-fast);
}

.property-thumbnail:hover {
    border-color: hsl(var(--primary));
}

.property-info-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

@media (max-width: 768px) {
    .property-info-grid {
        grid-template-columns: 1fr;
    }
}

.property-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
}

.property-spec {
    padding: var(--space-3);
    background-color: hsl(var(--muted));
    border-radius: var(--radius-md);
}

.property-spec-label {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    margin-bottom: var(--space-1);
}

.property-spec-value {
    font-size: var(--text-lg);
    font-weight: 600;
}

/* === Form Builder === */
.form-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-section {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.form-section-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid hsl(var(--border));
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid hsl(var(--border));
    justify-content: flex-end;
}

/* === Property Detail Show Page === */
.property-hero {
    background: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(var(--primary) / 0.05));
}

.property-hero-content {
    padding: var(--space-6);
}

.property-hero-badges {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.property-hero-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: hsl(var(--foreground));
}

.property-hero-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-base);
    color: hsl(var(--muted-foreground));
}

.property-hero-price {
    font-weight: 600;
    color: hsl(var(--primary));
    font-size: var(--text-lg);
}

.property-detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-6);
    margin-top: var(--space-6);
}

.property-detail-main {
    min-width: 0;
}

.property-detail-sidebar {
    min-width: 0;
}

.sticky-sidebar {
    position: sticky;
    top: var(--space-4);
}

/* Gallery Grid */
.property-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
}

.gallery-item-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    aspect-ratio: 4/3;
    border: 1px solid hsl(var(--border));
    transition: all var(--transition-base);
    max-height: 180px;
}

.gallery-item-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: hsl(var(--primary));
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: var(--space-3) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
}

/* Video */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: hsl(var(--muted));
    border-radius: var(--radius-md);
}

.video-iframe,
.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Description */
.property-description {
    line-height: 1.8;
    color: hsl(var(--foreground));
}

/* Specs Grid */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
}

.spec-group {
    padding: var(--space-4);
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius-md);
    border: 1px solid hsl(var(--border));
}

.spec-group-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: hsl(var(--foreground));
}

.spec-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid hsl(var(--border));
}

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

.spec-label {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
}

.spec-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* Features */
.feature-group {
    padding-bottom: var(--space-4);
    border-bottom: 1px solid hsl(var(--border));
}

.feature-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.feature-group-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: hsl(var(--foreground));
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1-5) var(--space-3);
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: hsl(var(--foreground));
    transition: all var(--transition-fast);
}

.feature-tag:hover {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

/* Editorial Sections */
.editorial-sections {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.editorial-section {
    padding: var(--space-4);
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius-md);
    border-left: 3px solid hsl(var(--primary));
}

.editorial-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: hsl(var(--foreground));
}

.editorial-content {
    line-height: 1.7;
    color: hsl(var(--muted-foreground));
}

/* Floor Plan */
.floor-plan-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid hsl(var(--border));
}

/* Sidebar - Price Display */
.price-display {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: hsl(var(--primary));
    margin-bottom: var(--space-2);
}

.price-currency {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: hsl(var(--muted-foreground));
}

.price-per-m2 {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
    padding-top: var(--space-2);
    border-top: 1px solid hsl(var(--border));
}

/* Key Info List */
.key-info-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.key-info-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius-sm);
}

.key-info-icon {
    font-size: var(--text-xl);
}

.key-info-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* Location Address */
.location-address {
    font-style: normal;
    line-height: 1.6;
    color: hsl(var(--foreground));
}

/* SEO Info */
.seo-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.seo-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.seo-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.seo-value {
    font-size: var(--text-sm);
    color: hsl(var(--foreground));
    padding: var(--space-2);
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius-sm);
    word-break: break-word;
}

/* Responsive */
@media (max-width: 1024px) {
    .property-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .property-detail-sidebar {
        order: -1;
    }
    
    .sticky-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .property-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    .property-hero-title {
        font-size: var(--text-2xl);
    }
    
    .price-display {
        font-size: var(--text-3xl);
    }
}

/* === Image Upload === */
.image-upload {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}

.image-upload:hover {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--muted));
}

.image-upload-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.image-upload-text {
    color: hsl(var(--muted-foreground));
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.image-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border: none;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-preview:hover .image-preview-remove {
    opacity: 1;
}

/* === Loading States === */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(var(--background) / 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* === Tabs === */
.tabs {
    display: flex;
    flex-direction: column;
}

.tabs-list {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.tab-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background-color: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.tab-trigger:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--accent));
    border-color: hsl(var(--accent));
}

.tab-trigger.active {
    color: hsl(var(--primary-foreground));
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Modal/Dialog === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal {
    background-color: hsl(var(--card));
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid hsl(var(--border));
}

.modal-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    margin: 0;
}

.modal-content {
    padding: var(--space-6);
}

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

/* === Dropdown Menu === */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    cursor: pointer;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    display: none;
}

.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-item {
    display: block;
    padding: var(--space-2) var(--space-4);
    color: hsl(var(--foreground));
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: hsl(var(--muted));
}

.dropdown-separator {
    height: 1px;
    background-color: hsl(var(--border));
    margin: var(--space-1) 0;
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
}

.toast {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.toast-description {
    font-size: var(--text-sm);
    color: hsl(var(--muted-foreground));
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: hsl(var(--muted-foreground));
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: hsl(var(--foreground));
}

.toast-success {
    border-left: 4px solid hsl(var(--success));
}

.toast-error {
    border-left: 4px solid hsl(var(--destructive));
}

.toast-warning {
    border-left: 4px solid hsl(var(--warning));
}

.toast-info {
    border-left: 4px solid hsl(var(--info));
}

/* === Pagination === */
.pagination {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: center;
    margin-top: var(--space-8);
}

.pagination-item {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-md);
    text-decoration: none;
    color: hsl(var(--foreground));
    transition: all var(--transition-fast);
}

.pagination-item:hover:not(.disabled) {
    background-color: hsl(var(--muted));
}

.pagination-item.active {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Breadcrumbs === */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
}

.breadcrumb-item {
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
    color: hsl(var(--foreground));
}

.breadcrumb-item.active {
    color: hsl(var(--foreground));
    font-weight: 500;
}

.breadcrumb-separator {
    color: hsl(var(--muted-foreground));
}

/* === Progress Bar === */
.progress {
    width: 100%;
    height: 8px;
    background-color: hsl(var(--muted));
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: hsl(var(--primary));
    transition: width var(--transition-slow);
}

/* === Switch/Toggle === */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(var(--muted));
    transition: var(--transition-base);
    border-radius: var(--radius-full);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: hsl(var(--primary));
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
}

/* === Checkbox & Radio === */
.checkbox,
.radio {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* === Skeleton Loader === */
.skeleton {
    background: linear-gradient(
        90deg,
        hsl(var(--muted)) 0%,
        hsl(var(--muted) / 0.5) 50%,
        hsl(var(--muted)) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-2);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
}

/* === Utilities === */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.pointer-events-none {
    pointer-events: none;
}

.select-none {
    -webkit-user-select: none;
    user-select: none;
}

/* === Media Preview Components === */
.media-preview {
    animation: fadeIn 0.3s ease-in-out;
}

.media-preview img {
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-preview img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

/* Thumbnail preview on the left side of gallery items */
.media-preview-thumbnail {
    flex-shrink: 0;
    animation: fadeIn 0.3s ease-in-out;
}

.media-preview-thumbnail img {
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid hsl(var(--border));
}

.media-preview-thumbnail img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    border-color: hsl(var(--primary));
}

.video-container {
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-container iframe,
.video-container video {
    border-radius: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media URL Input with preview indicator */
.media-url-input:valid:not(:placeholder-shown) {
    border-left: 3px solid hsl(var(--success));
}

.gallery-url-input:valid:not(:placeholder-shown) {
    border-left: 3px solid hsl(var(--success));
}

