/**
 * CSS for 3D Cubes Article Browser
 * 
 * @package AIMO3D
 */

#texts-content {
    width: 100%;
    height: 80vh;
    min-height: 500px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #87CEEB 0%, #98D8E8 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#app-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#app-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#app-canvas:active {
    cursor: grabbing;
}

/* Loading state */
.app-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--slate-earth);
    font-size: 18px;
    z-index: 10;
}

/* Modal styles */
.app-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: app-fadeIn 0.3s ease-out;
}

.app-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.app-modal-content {
    background-color: var(--bg-surface);
    border-radius: 16px;
    max-width: 90%;
    max-height: 90%;
    width: 600px;
    max-width: 90vw;
    overflow: hidden;
    position: relative;
    animation: app-slideUp 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.app-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-surface);
    color: var(--slate-earth);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-modal-close:hover {
    background-color: var(--line-muted);
    transform: scale(1.1);
}

.app-modal-body {
    padding: 0;
    max-height: 90vh;
    overflow-y: auto;
}

.app-modal-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background-color: var(--line-muted);
}

.app-modal-content-wrapper {
    padding: 32px;
}

.app-modal-title {
    font-size: 28px;
    font-weight: bold;
    color: var(--slate-earth);
    margin-bottom: 16px;
    line-height: 1.3;
}

.app-modal-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--slate-earth);
    white-space: pre-wrap;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #texts-content {
        height: 70vh;
        min-height: 350px;
        border-radius: 8px;
    }
    
    .app-modal-content {
        width: 95%;
        max-height: 95%;
        border-radius: 12px;
        margin: 10px;
    }
    
    .app-modal-image {
        height: 200px;
    }
    
    .app-modal-content-wrapper {
        padding: 20px;
    }
    
    .app-modal-title {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .app-modal-text {
        font-size: 15px;
        line-height: 1.6;
    }
    
    .app-modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    #texts-content {
        height: 60vh;
        min-height: 300px;
        border-radius: 0;
        margin: 0 -10px;
    }
    
    .app-modal-content {
        width: 98%;
        max-height: 98%;
        margin: 5px;
        border-radius: 8px;
    }
    
    .app-modal-image {
        height: 150px;
    }
    
    .app-modal-content-wrapper {
        padding: 16px;
    }
    
    .app-modal-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .app-modal-text {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .app-modal-close {
        width: 32px;
        height: 32px;
        font-size: 16px;
        top: 8px;
        right: 8px;
    }
    
    .app-loading {
        font-size: 16px;
    }
    
    .app-loading::after {
        width: 30px;
        height: 30px;
        margin: 15px auto;
    }
}

@media (max-width: 360px) {
    #texts-content {
        height: 55vh;
        min-height: 280px;
    }
    
    .app-modal-content-wrapper {
        padding: 12px;
    }
    
    .app-modal-title {
        font-size: 18px;
    }
    
    .app-modal-text {
        font-size: 13px;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    #app-canvas {
        touch-action: none;
    }
    
    /* Larger touch targets for mobile */
    .app-modal-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Prevent zoom on double tap for 3D scene */
    #texts-content {
        touch-action: manipulation;
    }
}

/* Landscape mobile optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    #texts-content {
        height: 85vh;
        min-height: 250px;
    }
    
    .app-modal-content {
        max-height: 90vh;
    }
    
    .app-modal-image {
        height: 120px;
    }
    
    .app-modal-content-wrapper {
        padding: 12px;
    }
    
    .app-modal-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .app-modal-text {
        font-size: 12px;
        line-height: 1.4;
    }
}

/* Small mobile devices */
@media (max-width: 320px) {
    #texts-content {
        height: 50vh;
        min-height: 250px;
        margin: 0 -5px;
    }
    
    .app-modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .app-modal-content-wrapper {
        padding: 10px;
    }
    
    .app-modal-title {
        font-size: 16px;
    }
    
    .app-modal-text {
        font-size: 12px;
    }
}

/* Hide scrollbar for modal but keep functionality */
.app-modal-body::-webkit-scrollbar {
    width: 6px;
}

.app-modal-body::-webkit-scrollbar-track {
    background: var(--line-muted);
}

.app-modal-body::-webkit-scrollbar-thumb {
    background: var(--tortoise);
    border-radius: 3px;
}

.app-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--amber);
}
