/* Double Royal 3D Widget */
.dr3d-widget {
    max-width: 1400px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Nagłówek */
.dr3d-header {
    margin-bottom: 30px;
    text-align: center;
}

.dr3d-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
}

.dr3d-title span {
    color: #8b4513;
}

/* Filtry */
.dr3d-filters {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dr3d-filter {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.dr3d-filter:hover {
    border-color: #8b4513;
    color: #8b4513;
    transform: translateY(-2px);
}

.dr3d-filter.active {
    background: #8b4513;
    color: white;
    border-color: #8b4513;
}

/* Widoki */
.dr3d-views {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.dr3d-view {
    padding: 12px 30px;
    border: none;
    background: #f5f5f5;
    color: #555;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.dr3d-view:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.dr3d-view.active {
    background: #8b4513;
    color: white;
}

/* Widok budynku */
.dr3d-building-view {
    position: relative;
    margin: 0 auto 40px auto;
}

.dr3d-building-container {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.dr3d-building-image {
    width: 100%;
    height: auto;
    display: block;
}

.dr3d-building-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Markery (kółka) - niewidoczne obszary klikalne */
.dr3d-marker-group {
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.dr3d-marker-group:hover {
    opacity: 0.8;
}

.dr3d-marker-invisible {
    pointer-events: all;
    cursor: pointer;
}

/* Debug mode */
.dr3d-debug-rect {
    fill: transparent;
    stroke-width: 2;
    stroke-dasharray: 5,5;
}

.dr3d-debug-available {
    stroke: #4CAF50;
}

.dr3d-debug-reserved {
    stroke: #FFC107;
}

.dr3d-debug-sold {
    stroke: #F44336;
}

/* Accordion lista - ukryta na desktop */
.dr3d-accordion-list {
    display: none;
}

/* Tabela */
.dr3d-table-view {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dr3d-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dr3d-table th {
    background: #8b4513;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.dr3d-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.dr3d-table tbody tr:hover {
    background: #f9f9f9;
}

.dr3d-table tbody tr:last-child td {
    border-bottom: none;
}

.dr3d-status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.dr3d-status-available {
    background: #4CAF50;
    color: white;
}

.dr3d-status-reserved {
    background: #FFC107;
    color: #333;
}

.dr3d-status-sold {
    background: #F44336;
    color: white;
}

.dr3d-table-btn {
    padding: 8px 16px;
    background: #8b4513;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.dr3d-table-btn:hover {
    background: #6d3510;
    transform: translateY(-2px);
}

/* Modal */
.dr3d-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.dr3d-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.dr3d-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.dr3d-modal-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.dr3d-modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
}

.dr3d-modal-status {
    margin-bottom: 25px;
}

.dr3d-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.dr3d-modal-image {
    overflow: hidden;
    border-radius: 8px;
}

.dr3d-modal-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.dr3d-modal-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dr3d-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.dr3d-modal-row:last-child {
    border-bottom: none;
}

.dr3d-modal-row span {
    color: #666;
    font-size: 14px;
}

.dr3d-modal-row strong {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.dr3d-modal-actions {
    display: flex;
    gap: 15px;
}

.dr3d-btn {
    flex: 1;
    padding: 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-block;
}

.dr3d-btn-pdf {
    background: #8b4513;
    color: white;
}

.dr3d-btn-pdf:hover {
    background: #6d3510;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.dr3d-btn-contact {
    background: #f5f5f5;
    color: #333;
}

.dr3d-btn-contact:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

/* Mobile & Tablet */
@media (max-width: 1024px) {
    .dr3d-marker-label {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .dr3d-widget {
        padding: 15px 10px;
        margin: 20px auto;
    }

    .dr3d-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    /* Filtry - siatka 2x2 */
    .dr3d-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 15px;
    }

    .dr3d-filter {
        font-size: 13px;
        padding: 12px 10px;
        text-align: center;
    }

    /* Widoki - jeden pod drugim */
    .dr3d-views {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .dr3d-view {
        font-size: 14px;
        padding: 14px;
        width: 100%;
        text-align: center;
    }

    /* Budynek - bez obramowania */
    .dr3d-building-container {
        box-shadow: none;
        border-radius: 0;
    }

    .dr3d-marker-label {
        font-size: 10px;
    }

    /* TABELA - UKRYJ i pokaż jako accordion */
    .dr3d-table-view::before {
        display: none;
    }

    .dr3d-table-scroll {
        display: none;
    }

    .dr3d-table {
        display: none;
    }

    /* Accordion lista mieszkań */
    .dr3d-accordion-list {
        display: block;
    }

    .dr3d-accordion-item {
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 10px;
        overflow: hidden;
    }

    .dr3d-accordion-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        cursor: pointer;
        background: white;
        border: none;
        width: 100%;
        text-align: left;
        transition: background 0.2s;
    }

    .dr3d-accordion-header:active {
        background: #f5f5f5;
    }

    .dr3d-accordion-header-left {
        flex: 1;
    }

    .dr3d-accordion-id {
        font-size: 16px;
        font-weight: 700;
        color: #2c3e50;
        margin-bottom: 4px;
    }

    .dr3d-accordion-quick {
        font-size: 12px;
        color: #666;
    }

    .dr3d-accordion-header-right {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }

    .dr3d-accordion-price {
        font-size: 15px;
        font-weight: 700;
        color: #2c3e50;
    }

    .dr3d-accordion-icon {
        font-size: 20px;
        color: #999;
        transition: transform 0.3s;
        margin-left: 10px;
    }

    .dr3d-accordion-item.active .dr3d-accordion-icon {
        transform: rotate(180deg);
    }

    /* Nadpisanie koloru tła aktywnego accordion - zapobiegaj kolorom motywu */
    .dr3d-accordion-item.active {
        background: #f9be00 !important;
        border-color: #f9be00 !important;
    }

    .dr3d-accordion-item.active .dr3d-accordion-header {
        background: #f9be00 !important;
    }

    .dr3d-accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background: #f9f9f9;
    }

    .dr3d-accordion-item.active .dr3d-accordion-content {
        max-height: 500px;
        background: #ffffff !important;
    }

    .dr3d-accordion-details {
        padding: 15px;
    }

    .dr3d-accordion-row {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .dr3d-accordion-row:last-child {
        border-bottom: none;
    }

    .dr3d-accordion-label {
        color: #666;
        font-size: 13px;
    }

    .dr3d-accordion-value {
        color: #2c3e50;
        font-weight: 600;
        font-size: 14px;
    }

    .dr3d-accordion-btn {
        width: 100%;
        margin-top: 15px;
        padding: 14px;
        background: #8b4513;
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.3s;
    }

    .dr3d-accordion-btn:active {
        background: #6d3510;
        transform: scale(0.98);
    }

    /* Modal na mobile */
    .dr3d-modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dr3d-modal-content {
        padding: 25px 15px;
        max-height: 95vh;
    }

    .dr3d-modal-title {
        font-size: 20px;
    }

    .dr3d-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
}

/* Bardzo małe ekrany (telefony) */
@media (max-width: 480px) {
    .dr3d-widget {
        padding: 10px;
        margin: 15px auto;
    }

    .dr3d-title {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .dr3d-filters {
        gap: 6px;
    }

    .dr3d-filter {
        font-size: 11px;
        padding: 6px 12px;
    }

    .dr3d-views {
        gap: 6px;
    }

    .dr3d-view {
        font-size: 11px;
        padding: 8px 16px;
    }

    /* Tabela - jeszcze bardziej kompaktowa */
    .dr3d-table-view {
        margin: 15px 0;
    }

    .dr3d-table-view::before {
        font-size: 10px;
        padding: 6px;
    }

    .dr3d-table {
        width: 600px;
        min-width: 600px;
        font-size: 10px;
    }

    .dr3d-table th,
    .dr3d-table td {
        padding: 8px 4px;
        font-size: 10px;
    }

    /* Mniejsze szerokości dla małych ekranów */
    .dr3d-table th:nth-child(1),
    .dr3d-table td:nth-child(1) {
        width: 60px;
    }

    .dr3d-table th:nth-child(2),
    .dr3d-table td:nth-child(2) {
        width: 75px;
    }

    .dr3d-table th:nth-child(3),
    .dr3d-table td:nth-child(3) {
        width: 55px;
    }

    .dr3d-table th:nth-child(4),
    .dr3d-table td:nth-child(4) {
        width: 100px;
    }

    .dr3d-table th:nth-child(5),
    .dr3d-table td:nth-child(5) {
        width: 110px;
    }

    .dr3d-table th:nth-child(6),
    .dr3d-table td:nth-child(6) {
        width: 120px;
    }

    .dr3d-table th:nth-child(7),
    .dr3d-table td:nth-child(7) {
        width: 80px;
    }

    .dr3d-status-badge {
        padding: 4px 8px;
        font-size: 9px;
    }

    .dr3d-table-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    /* Modal na małych ekranach */
    .dr3d-modal-content {
        padding: 20px 15px;
        max-height: 90vh;
    }

    .dr3d-modal-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .dr3d-modal-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }

    .dr3d-modal-row {
        padding: 8px 0;
    }

    .dr3d-modal-row span {
        font-size: 12px;
    }

    .dr3d-modal-row strong {
        font-size: 14px;
    }

    .dr3d-btn {
        padding: 12px;
        font-size: 13px;
    }
}

/* Touch devices - większe obszary klikalne */
@media (hover: none) and (pointer: coarse) {
    .dr3d-marker-group {
        cursor: default;
    }

    .dr3d-marker {
        opacity: 1;
    }

    .dr3d-filter,
    .dr3d-view,
    .dr3d-table-btn {
        padding: 12px 20px;
        min-height: 44px;
    }

    .dr3d-modal-close {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loader (opcjonalnie) */
.dr3d-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.dr3d-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}
