/**
 * Templates CSS
 * 
 * Base styles for all template types (map, list, single)
 * Used on the frontend to style the rendered templates.
 */

/* Base Template Styles */
.ucm-template {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

.ucm-template * {
    box-sizing: border-box;
}

.ucm-template img {
    max-width: 100%;
    height: auto;
}

/* Map Template Styles */
.ucm-map-template {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ucm-map-container {
    flex: 1;
    position: relative;
    min-height: 400px;
    background: #f5f5f5;
}

.ucm-map-container .map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 16px;
}

.ucm-map-sidebar {
    width: 300px;
    padding: 20px;
    background: #fafafa;
    border-left: 1px solid #e1e1e1;
    overflow-y: auto;
    max-height: 500px;
}

.ucm-map-sidebar.left {
    order: -1;
    border-left: none;
    border-right: 1px solid #e1e1e1;
}

.ucm-map-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

.ucm-map-filters h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ucm-map-search {
    margin-bottom: 20px;
}

.ucm-map-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.ucm-map-search input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.ucm-filter-group {
    margin-bottom: 15px;
}

.ucm-filter-group:last-child {
    margin-bottom: 0;
}

.ucm-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.ucm-filter-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.ucm-map-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
}

/* Full Width Map */
.ucm-map-fullwidth {
    margin: 20px 0;
    position: relative;
}

.ucm-map-fullwidth .ucm-map-container {
    width: 100%;
    min-height: 500px;
}

/* Minimal Map */
.ucm-map-minimal {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ucm-map-minimal .ucm-map-container {
    width: 100%;
    min-height: 400px;
}

/* List Template Styles */
.ucm-list-template {
    margin: 20px 0;
}

.ucm-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

.ucm-list-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.ucm-list-count {
    color: #666;
    font-size: 14px;
}

.ucm-list-search {
    flex: 1;
    max-width: 300px;
    margin-left: 20px;
}

.ucm-list-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Table List */
.ucm-list-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ucm-list-table th,
.ucm-list-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.ucm-list-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ucm-list-table tr:hover {
    background: #f8f9fa;
}

.ucm-list-table tr:last-child td {
    border-bottom: none;
}

.ucm-list-table .item-title {
    font-weight: 600;
    color: #0073aa;
}

.ucm-list-table .item-title a {
    color: inherit;
    text-decoration: none;
}

.ucm-list-table .item-title a:hover {
    text-decoration: underline;
}

.ucm-list-table .item-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.ucm-list-table .status-active {
    background: #d4edda;
    color: #155724;
}

.ucm-list-table .status-pending {
    background: #fff3cd;
    color: #856404;
}

.ucm-list-table .status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Card List */
.ucm-list-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.ucm-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.ucm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ucm-card-image {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

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

.ucm-card-content {
    padding: 20px;
}

.ucm-card-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ucm-card-title a {
    color: inherit;
    text-decoration: none;
}

.ucm-card-title a:hover {
    color: #0073aa;
}

.ucm-card-description {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.ucm-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.ucm-card-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ucm-card-date::before {
    content: "📅";
    font-size: 14px;
}

/* Timeline List */
.ucm-list-timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 20px;
}

.ucm-list-timeline::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e1e1e1;
}

.ucm-timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ucm-timeline-item::before {
    content: "";
    position: absolute;
    left: -37px;
    top: 25px;
    width: 12px;
    height: 12px;
    background: #0073aa;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #e1e1e1;
}

.ucm-timeline-date {
    position: absolute;
    left: -120px;
    top: 20px;
    width: 80px;
    text-align: right;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.ucm-timeline-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ucm-timeline-content {
    color: #666;
    line-height: 1.5;
}

/* Single Template Styles */
.ucm-single-template {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ucm-single-header {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e1e1;
}

.ucm-single-title {
    margin: 0 0 15px 0;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.ucm-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.ucm-single-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ucm-single-content {
    padding: 30px;
}

.ucm-single-description {
    margin: 0 0 30px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.ucm-single-map {
    margin: 0 0 30px 0;
    height: 300px;
    background: #f5f5f5;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.ucm-single-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 0 0 30px 0;
}

.ucm-field-group {
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

.ucm-field-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ucm-field-value {
    font-size: 16px;
    color: #333;
}

.ucm-single-gallery {
    margin: 0 0 30px 0;
}

.ucm-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.ucm-gallery-item {
    aspect-ratio: 1;
    background: #f5f5f5;
    border-radius: 6px;
    overflow: hidden;
}

.ucm-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ucm-single-related {
    padding: 30px;
    background: #f8f9fa;
    border-top: 1px solid #e1e1e1;
}

.ucm-related-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.ucm-related-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.ucm-related-item {
    padding: 15px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.ucm-related-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.ucm-related-item-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ucm-related-item-meta {
    font-size: 12px;
    color: #666;
}

/* Pagination */
.ucm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

.ucm-pagination a,
.ucm-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ucm-pagination a:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.ucm-pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

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

/* Loading States */
.ucm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.ucm-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #e1e1e1;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .ucm-map-template {
        flex-direction: column;
    }
    
    .ucm-map-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e1e1e1;
        max-height: none;
    }
    
    .ucm-map-sidebar.left {
        order: 0;
        border-right: none;
        border-bottom: 1px solid #e1e1e1;
    }
    
    .ucm-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .ucm-list-search {
        margin-left: 0;
        max-width: none;
    }
    
    .ucm-list-cards {
        grid-template-columns: 1fr;
    }
    
    .ucm-list-timeline {
        padding-left: 20px;
    }
    
    .ucm-timeline-date {
        position: static;
        width: auto;
        text-align: left;
        margin-bottom: 10px;
    }
    
    .ucm-single-template {
        margin: 10px;
        border-radius: 0;
    }
    
    .ucm-single-header,
    .ucm-single-content,
    .ucm-single-related {
        padding: 20px;
    }
    
    .ucm-single-fields {
        grid-template-columns: 1fr;
    }
    
    .ucm-related-items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ucm-list-table {
        font-size: 14px;
    }
    
    .ucm-list-table th,
    .ucm-list-table td {
        padding: 8px 10px;
    }
    
    .ucm-card-content {
        padding: 15px;
    }
    
    .ucm-single-title {
        font-size: 24px;
    }
    
    .ucm-single-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .ucm-map-container,
    .ucm-single-map {
        background: #f5f5f5;
        border: 1px solid #ccc;
    }
    
    .ucm-map-container::after,
    .ucm-single-map::after {
        content: "[Map not available in print]";
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: #666;
    }
    
    .ucm-card:hover,
    .ucm-related-item:hover {
        transform: none;
        box-shadow: none;
    }
}