/**
 * Portal Frontend Styles
 */

/* Variables */
:root {
    --portal-primary: #2563eb;
    --portal-primary-dark: #1d4ed8;
    --portal-success: #16a34a;
    --portal-warning: #f59e0b;
    --portal-gray-50: #f9fafb;
    --portal-gray-100: #f3f4f6;
    --portal-gray-200: #e5e7eb;
    --portal-gray-300: #d1d5db;
    --portal-gray-500: #6b7280;
    --portal-gray-700: #374151;
    --portal-gray-900: #111827;
    --portal-radius: 8px;
    --portal-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --portal-shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

/* Container */
.portal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === SINGLE COMPANY === */

.portal-company {
    padding: 40px 0;
    background: var(--portal-gray-50);
}

/* Header */
.portal-company-header {
    background: #fff;
    padding: 30px;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    margin-bottom: 30px;
}

.portal-company-header-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.portal-company-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.portal-company-header-info {
    flex: 1;
}

.portal-company-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--portal-gray-900);
}

.portal-company-summary {
    color: var(--portal-gray-500);
    margin: 10px 0 0;
    font-size: 16px;
}

.portal-company-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Rating */
.portal-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
}

.portal-rating-value {
    font-weight: 700;
    color: var(--portal-gray-900);
}

.portal-rating-star {
    color: var(--portal-warning);
}

.portal-rating-count {
    color: var(--portal-gray-500);
    font-size: 14px;
}

/* Content Layout */
.portal-company-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

@media (max-width: 900px) {
    .portal-company-content {
        grid-template-columns: 1fr;
    }

    .portal-company-sidebar {
        order: -1;
    }
}

.portal-company-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Sections */
.portal-section {
    background: #fff;
    padding: 25px;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.portal-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--portal-gray-900);
}

/* Gallery */
.portal-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.portal-gallery-item {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--portal-radius);
}

.portal-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.portal-gallery-item:hover img {
    transform: scale(1.05);
}

/* Lists */
.portal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-list li {
    padding: 8px 0 8px 28px;
    position: relative;
    border-bottom: 1px solid var(--portal-gray-100);
}

.portal-list li:last-child {
    border-bottom: none;
}

.portal-list-check li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--portal-success);
    font-weight: 700;
}

.portal-list-info li::before {
    content: "i";
    position: absolute;
    left: 0;
    width: 18px;
    height: 18px;
    background: var(--portal-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
}

/* Opinion */
.portal-opinion-text {
    color: var(--portal-gray-700);
    line-height: 1.7;
    font-style: italic;
    padding-left: 20px;
    border-left: 3px solid var(--portal-primary);
}

/* Prices Table */
.portal-prices-table {
    width: 100%;
    border-collapse: collapse;
}

.portal-prices-table th,
.portal-prices-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--portal-gray-200);
}

.portal-prices-table th {
    background: var(--portal-gray-50);
    font-weight: 600;
    font-size: 14px;
    color: var(--portal-gray-700);
}

.portal-prices-table tr:hover {
    background: var(--portal-gray-50);
}

.portal-price-value {
    font-weight: 600;
    white-space: nowrap;
    color: var(--portal-gray-900);
}

/* Reviews */
.portal-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.portal-review {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--portal-gray-200);
}

.portal-review:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.portal-review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.portal-review-author {
    font-weight: 600;
    color: var(--portal-gray-900);
}

.portal-review-rating {
    color: var(--portal-warning);
    font-weight: 600;
}

.portal-review-date {
    color: var(--portal-gray-500);
    font-size: 14px;
}

.portal-review-text {
    color: var(--portal-gray-700);
    line-height: 1.6;
}

/* Sidebar */
.portal-company-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.portal-sidebar-block {
    background: #fff;
    padding: 20px;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.portal-sidebar-block h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px;
    color: var(--portal-gray-900);
}

/* Contacts */
.portal-contact-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--portal-gray-100);
}

.portal-contact-item:last-child {
    border-bottom: none;
}

.portal-contact-label {
    display: block;
    font-size: 12px;
    color: var(--portal-gray-500);
    margin-bottom: 4px;
}

.portal-contact-value {
    color: var(--portal-gray-900);
    text-decoration: none;
}

a.portal-contact-value:hover {
    color: var(--portal-primary);
}

.portal-phone {
    font-weight: 600;
    font-size: 18px;
}

.portal-link-map {
    display: inline-block;
    margin-left: 8px;
    font-size: 14px;
    color: var(--portal-primary);
}

/* Tags */
.portal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.portal-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--portal-gray-100);
    border-radius: 20px;
    font-size: 13px;
    color: var(--portal-gray-700);
    text-decoration: none;
    transition: background 0.2s;
}

.portal-tag:hover {
    background: var(--portal-gray-200);
}

.portal-tag-category {
    background: var(--portal-primary);
    color: #fff;
}

.portal-tag-category:hover {
    background: var(--portal-primary-dark);
    color: #fff;
}

.portal-tag-district {
    background: var(--portal-success);
    color: #fff;
}

.portal-tag-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Amenities */
.portal-amenities-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-amenities-list li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--portal-gray-700);
}

/* Staff */
.portal-staff-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-staff-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--portal-gray-100);
}

.portal-staff-list li:last-child {
    border-bottom: none;
}

.portal-staff-list strong {
    display: block;
    color: var(--portal-gray-900);
}

.portal-staff-list span {
    font-size: 13px;
    color: var(--portal-gray-500);
}

/* === ARCHIVE === */

.portal-archive {
    padding: 40px 0;
    background: var(--portal-gray-50);
    min-height: 100vh;
}

.portal-archive-header {
    margin-bottom: 30px;
}

.portal-archive-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--portal-gray-900);
}

.portal-archive-count {
    color: var(--portal-gray-500);
    margin: 0;
}

.portal-archive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

@media (max-width: 800px) {
    .portal-archive-layout {
        grid-template-columns: 1fr;
    }
}

/* Filters */
.portal-filters {
    background: #fff;
    padding: 20px;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.portal-filter-group {
    margin-bottom: 20px;
}

.portal-filter-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--portal-gray-700);
}

.portal-filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--portal-gray-300);
    border-radius: var(--portal-radius);
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.portal-filter-group select:focus {
    outline: none;
    border-color: var(--portal-primary);
}

/* Buttons */
.portal-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--portal-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.portal-btn-primary {
    background: var(--portal-primary);
    color: #fff;
}

.portal-btn-primary:hover {
    background: var(--portal-primary-dark);
}

.portal-btn-secondary {
    background: var(--portal-gray-200);
    color: var(--portal-gray-700);
}

.portal-btn-secondary:hover {
    background: var(--portal-gray-300);
}

/* Companies Grid */
.portal-companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Company Card */
.portal-card {
    background: #fff;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.portal-card:hover {
    box-shadow: var(--portal-shadow-lg);
    transform: translateY(-2px);
}

.portal-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.portal-card-image {
    height: 180px;
    background: var(--portal-gray-100);
    position: relative;
    overflow: hidden;
}

.portal-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-card-logo-fallback {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.portal-card-logo {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--portal-shadow);
}

.portal-card-body {
    padding: 15px;
}

.portal-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--portal-gray-900);
}

.portal-card-rating {
    margin-bottom: 8px;
}

.portal-card-address,
.portal-card-hours {
    font-size: 14px;
    color: var(--portal-gray-500);
    margin: 4px 0;
}

.portal-card-tags {
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.portal-tag-more {
    background: var(--portal-gray-300);
}

.portal-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-top: 1px solid var(--portal-gray-100);
    margin-top: 10px;
}

.portal-card-badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.portal-badge-prices {
    background: #dcfce7;
    color: #166534;
}

.portal-card-phone {
    font-size: 14px;
    font-weight: 600;
    color: var(--portal-primary);
    text-decoration: none;
}

.portal-card-phone:hover {
    text-decoration: underline;
}

/* No Results */
.portal-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--portal-gray-500);
}

/* Pagination */
.portal-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.portal-pagination a,
.portal-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--portal-radius);
    text-decoration: none;
    font-weight: 500;
}

.portal-pagination a {
    background: #fff;
    color: var(--portal-gray-700);
    box-shadow: var(--portal-shadow);
}

.portal-pagination a:hover {
    background: var(--portal-primary);
    color: #fff;
}

.portal-pagination .current {
    background: var(--portal-primary);
    color: #fff;
}

/* Prose */
.portal-prose {
    line-height: 1.7;
    color: var(--portal-gray-700);
}

.portal-prose p {
    margin: 0 0 1em;
}

/* === MAPS === */

/* Single page map */
#portal-map-single {
    height: 250px;
    border-radius: var(--portal-radius);
    z-index: 1;
}

.portal-map-block {
    padding: 15px;
}

.portal-map-block h3 {
    margin-bottom: 10px;
}

/* Archive page map */
.portal-archive-map {
    margin-bottom: 30px;
}

#portal-map-archive {
    height: 400px;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    z-index: 1;
}

@media (max-width: 800px) {
    #portal-map-archive {
        height: 300px;
    }
}

/* Leaflet popup styles */
.leaflet-popup-content {
    margin: 10px 15px;
    font-size: 14px;
    line-height: 1.5;
}

.leaflet-popup-content strong {
    font-size: 15px;
    color: var(--portal-gray-900);
}

.leaflet-popup-content a {
    color: var(--portal-primary);
    text-decoration: none;
}

.leaflet-popup-content a:hover {
    text-decoration: underline;
}

.leaflet-popup-content small {
    color: var(--portal-gray-500);
}

/* === EXPAND BUTTONS === */

.portal-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.portal-expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.portal-expand-btn.expanded .icon {
    transform: rotate(180deg);
}

.portal-expand-btn .icon {
    transition: transform 0.2s;
    font-size: 12px;
}

.portal-expand-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    margin-top: 10px;
}

/* === LIGHTBOX === */

.portal-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.portal-lightbox.active {
    display: block;
}

.portal-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.portal-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    box-sizing: border-box;
}

.portal-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.portal-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.portal-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.portal-lightbox-prev,
.portal-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.portal-lightbox-prev {
    left: 15px;
}

.portal-lightbox-next {
    right: 15px;
}

.portal-lightbox-prev:hover,
.portal-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.portal-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

@media (max-width: 600px) {
    .portal-lightbox-prev,
    .portal-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .portal-lightbox-prev {
        left: 10px;
    }

    .portal-lightbox-next {
        right: 10px;
    }

    .portal-lightbox-content {
        padding: 50px 10px;
    }
}
