/* EducaPlay Modal Styles */

/* Base modal styles for EducaPlay modals */
#educaPlayModal.modal,
#metadataModal.modal,
#buildEducaPlayModal.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000000;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    padding: 0;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

#educaPlayModal.modal[style*="display: block"],
#metadataModal.modal[style*="display: block"],
#buildEducaPlayModal.modal[style*="display: block"] {
    display: flex !important;
}

/* Main Playground list modal */
#educaPlayModal .modal-content {
    width: 90vw;
    max-width: 900px;
    max-height: 85vh;
    background: #2c2c2c;
    color: white;
    border-radius: 15px;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    displaye: flex;
    flex-direction: column;
}

/* Playground metadata section at top of builder */
.playground-metadata {
    /* background: #1a1a1a; */
    /* border-radius: 10px; */
    /* padding: 20px; */
    margin-bottom: 20px;
    /* border: 1px solid #404040; */
}

.metadata-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.metadata-input {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    border: 1px solid #5a5a5a;
    border-radius: 8px;
    background: #2c2c2c;
    color: white;
    font-size: 14px;
}

.metadata-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.metadata-select {
    min-width: 150px;
    padding: 12px 15px;
    border: 1px solid #5a5a5a;
    border-radius: 8px;
    background: #2c2c2c;
    color: white;
    font-size: 14px;
}

.metadata-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.save-btn {
    min-width: 100px;
    padding: 12px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.save-btn:hover {
    background: #218838;
}

.save-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.undo-btn, .redo-btn {
    min-width: 48px;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: 2px solid #5a5a5a;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.undo-btn:hover:not(:disabled), .redo-btn:hover:not(:disabled) {
    background: #5a6268;
    border-color: #4a4a4a;
    transform: translateY(-1px);
}

.undo-btn:disabled, .redo-btn:disabled {
    background: #3a3a3a;
    border-color: #2a2a2a;
    cursor: not-allowed;
    opacity: 0.5;
}

.undo-btn img, .redo-btn img {
    filter: brightness(0) invert(1);
    opacity: inherit;
}

.educaplay-sections {
    margin-bottom: 20px;
}

.educaplay-section {
    margin-bottom: 20px;
}

.educaplay-table-header {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.educaplay-column-header {
    flex: 1;
    text-align: left;
}

.educaplay-column-header.title {
    flex: 3; /* Más espacio para el título */
    text-align: left;
}



.educaplay-column-header.actions {
    flex: 1;
    text-align: center;
}

.educaplays-list {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    min-height: 200px;
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.educaplay-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.educaplay-item:hover {
    background-color: #f8f9fa;
}

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

.educaplay-column {
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #212529; /* Fix: Add dark text color for white background */
}

.educaplay-column.title {
    flex: 3; /* Más espacio para el título */
    font-weight: 500;
    color: #212529; /* Fix: Ensure title is visible */
    text-align: left; /* Alineado a la izquierda */
}



.educaplay-column.actions {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.educaplay-actions {
    text-align: center;
    margin-top: 20px;
}

.action-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.action-btn.edit-btn:hover {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.action-btn.play-btn:hover {
    background-color: #e8f5e8;
    border-color: #4caf50;
}

.action-btn.share-btn:hover {
    background-color: #fff3e0;
    border-color: #ff9800;
}

.action-btn.delete-btn:hover {
    background-color: #ffebee;
    border-color: #f44336;
}

.loading-educaplays, .empty-message, .error-message {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.error-message {
    color: #dc3545;
}

/* Metadata Modal Styles */
#metadataModal .modal-content.educaplay-setup {
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    background: #2c2c2c;
    color: white;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    overflow-y: auto;
}

.educaplay-setup .modal-title {
    color: white;
    font-size: 2rem;
    margin-bottom: 10px;
    text-decoration: underline;
}

.modal-subtitle {
    color: #ccc;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.educaplay-setup-form {
    margin-bottom: 30px;
}

.setup-input, .setup-select {
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 2px solid #5a5a5a;
    border-radius: 25px;
    background: transparent;
    color: white;
    font-size: 1rem;
}

.setup-input::placeholder {
    color: #888;
}

.setup-input:focus, .setup-select:focus {
    outline: none;
    border-color: #007bff;
}

.setup-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.setup-select option {
    background: #2c2c2c;
    color: white;
}

/* Builder Modal (Step 2) Styles */
#buildEducaPlayModal .modal-content.educaplay-builder {
    width: 90vw;
    height: 85vh;
    max-width: none;
    max-height: none;
    background: #2c2c2c;
    color: white;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

/* Removed modal title styles since we removed the title */

/* Tabs Navigation */
.playground-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #404040;
}

.tab-btn {
    background: #1a1a1a;
    color: #ccc;
    border: none;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 10px 10px 0 0;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #333;
    color: white;
}

.tab-btn.active {
    background: #4fc3f7;
    color: white;
    border-bottom-color: #4fc3f7;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

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

/* Metrics Tab Content */
.metrics-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: #1a1a1a;
    border-radius: 15px;
    border: 2px solid #404040;
}

.metrics-placeholder {
    text-align: center;
    color: #ccc;
    padding: 40px;
}

.metrics-placeholder h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.metrics-placeholder p {
    font-size: 1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.educaplay-main-container {
    flex: 1;
    display: flex;
    gap: 20px;
    min-height: 0;
}

.educaplay-chat-container {
    width: 25%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.educaplay-canvas-container {
    width: 75%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.educaplay-canvas {
    flex: 1;
    border: 2px solid #5a5a5a;
    border-radius: 15px;
    background: white;
    color: black;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    box-sizing: border-box;
    position: relative;
}

.educaplay-canvas * {
    box-sizing: border-box;
}

.educaplay-canvas > * {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.canvas-placeholder {
    text-align: center;
    color: #888;
    font-size: 1.2rem;
}

.canvas-error {
    text-align: center;
    color: #dc3545;
    padding: 20px;
}

.educaplay-chat {
    flex: 1;
    border: 1px solid #5a5a5a;
    border-radius: 10px;
    background: #1a1a1a;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 15px;
    min-height: 0;
}

.chat-message {
    margin-bottom: 15px;
}

.chat-message.user {
    text-align: right;
}

.chat-message.user .message-content {
    background: #7d7d7d;
    color: white;
    border-radius: 15px 15px 5px 15px;
    padding: 10px 15px;
    display: inline-block;
    max-width: 80%;
}

.chat-message.assistant {
    text-align: left;
}

.chat-message.assistant .message-content {
    background: #333;
    color: white;
    border-radius: 15px 15px 15px 5px;
    padding: 10px 15px;
    display: inline-block;
    max-width: 80%;
}

.educaplay-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    margin-top: 10px;
}

.educaplay-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #5a5a5a;
    border-radius: 25px;
    background: transparent;
    color: white;
    font-size: 1rem;
}

.educaplay-input::placeholder {
    color: #888;
}

.educaplay-input:focus {
    outline: none;
    border-color: #007bff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.button {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
}

.button.primary {
    background-color: #4fc3f7;
    color: white;
}

.button.primary:hover {
    background-color: #29b6f6;
    transform: translateY(-1px);
}

.button.secondary {
    background-color: transparent;
    color: #ccc;
    border: 2px solid #5a5a5a;
}

.button.secondary:hover {
    background-color: #5a5a5a;
    color: white;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    #buildEducaPlayModal .modal-content.educaplay-builder {
        width: 98vw;
        height: 95vh;
    }
    
    .playground-tabs {
        margin-bottom: 15px;
    }
    
    .tab-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .educaplay-main-container {
        flex-direction: column;
    }
    
    .educaplay-chat-container {
        width: 100%;
        height: 30%;
        min-height: 200px;
    }
    
    .educaplay-canvas-container {
        width: 100%;
        height: 70%;
        min-height: 300px;
    }
    
    .metrics-container {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    #metadataModal .modal-content.educaplay-setup {
        width: 95%;
        padding: 20px;
    }
    
    #buildEducaPlayModal .modal-content.educaplay-builder {
        width: 98vw;
        height: 95vh;
        padding: 15px;
    }
    
    .metadata-row {
        gap: 10px;
    }
    
    .undo-btn, .redo-btn {
        min-width: 44px;
        padding: 10px;
    }
    
    .undo-btn img, .redo-btn img {
        width: 14px;
        height: 14px;
    }
    
    .playground-tabs {
        margin-bottom: 10px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 0.8rem;
    }
    
    .educaplay-chat-container {
        height: 35%;
        min-height: 180px;
    }
    
    .educaplay-canvas-container {
        height: 65%;
        min-height: 250px;
    }
    
    .metrics-container {
        min-height: 250px;
    }
    
    .metrics-placeholder {
        padding: 20px;
    }
    
    .metrics-placeholder h3 {
        font-size: 1.2rem;
    }
    
    .metrics-placeholder p {
        font-size: 0.9rem;
    }
    
    .educaplay-input-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .educaplay-input {
        width: 100%;
    }
    
    .educaplay-table-header,
    .educaplay-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .educaplay-column {
        flex: none;
        width: 100%;
        margin-bottom: 5px;
    }
    
    .educaplay-column.actions {
        text-align: left;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #metadataModal .modal-content.educaplay-setup {
        padding: 15px;
    }
    
    #metadataModal .modal-content.educaplay-setup .modal-title {
        font-size: 1.5rem;
    }
    
    #metadataModal .modal-content.educaplay-setup .modal-subtitle {
        font-size: 1rem;
    }
    
    #metadataModal .modal-content.educaplay-setup .setup-input, 
    #metadataModal .modal-content.educaplay-setup .setup-select {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    #buildEducaPlayModal .modal-content.educaplay-builder {
        padding: 10px;
    }
    
    .playground-tabs {
        margin-bottom: 8px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .educaplay-main-container {
        gap: 10px;
    }
    
    .educaplay-chat-container {
        height: 40%;
        min-height: 150px;
    }
    
    .educaplay-canvas-container {
        height: 60%;
        min-height: 200px;
    }
    
    .metrics-container {
        min-height: 200px;
    }
    
    .metrics-placeholder {
        padding: 15px;
    }
    
    .metrics-placeholder h3 {
        font-size: 1.1rem;
    }
    
    .metrics-placeholder p {
        font-size: 0.8rem;
    }
}

/* Additional styling for dark theme */
.modal-content {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

#educaPlayModal .close,
#metadataModal .close,
#buildEducaPlayModal .close {
    filter: brightness(0) invert(1);
    opacity: 0.7;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    cursor: pointer;
}

#educaPlayModal .close:hover,
#metadataModal .close:hover,
#buildEducaPlayModal .close:hover {
    opacity: 1;
}

/* Scrollbar styling for dark theme */
.educaplay-chat::-webkit-scrollbar {
    width: 6px;
}

.educaplay-chat::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.educaplay-chat::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.educaplay-chat::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Loading animation for messages */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.chat-message .message-content:contains("...") {
    animation: pulse 1.5s infinite;
}

/* Canvas state animations */
.educaplay-canvas {
    transition: all 0.3s ease;
}

.educaplay-canvas:empty {
    border-style: dashed;
    border-color: #888;
}

/* Animation for modal appearance */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

#metadataModal[style*="display: block"] .modal-content.educaplay-setup {
    animation: fadeIn 0.4s ease-out;
}

#buildEducaPlayModal[style*="display: block"] .modal-content.educaplay-builder {
    animation: slideUp 0.5s ease-out;
} 

/* Notificación para usuarios anónimos */
.anonymous-notice {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(240, 147, 251, 0.3);
}

.anonymous-notice-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: white;
    font-size: 14px;
}

.anonymous-icon {
    font-size: 18px;
    margin-right: 10px;
    opacity: 0.9;
}

.anonymous-text {
    flex: 1;
    line-height: 1.4;
}

.anonymous-dismiss {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    margin-left: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anonymous-dismiss:hover {
    opacity: 1;
}

/* Metrics Dashboard Layout */
.metrics-dashboard {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
}

.metrics-log-list {
    width: 35%;
    border: 1px solid #404040;
    border-radius: 10px;
    background: #1a1a1a;
    overflow-y: auto;
    min-height: 0;
}

.metrics-log-list ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.log-item {
    padding: 15px;
    border-bottom: 1px solid #404040;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.log-item:hover {
    background-color: #333;
}

.log-item.active {
    background-color: #4fc3f7;
    color: white;
}

.log-item-date {
    font-weight: 600;
    font-size: 14px;
}

.log-item-user {
    font-size: 13px;
    color: #ccc;
}

.log-item.active .log-item-user {
    color: white;
}

.log-item-count {
    font-size: 12px;
    background: #555;
    padding: 3px 8px;
    border-radius: 10px;
}

.log-item.active .log-item-count {
    background: white;
    color: #4fc3f7;
}


.metrics-summary {
    width: 65%;
    border: 1px solid #404040;
    border-radius: 10px;
    background: #1a1a1a;
    overflow-y: auto;
    min-height: 0;
    padding: 20px;
    color: #eee;
    line-height: 1.6;
}

.summary-content strong {
    color: #4fc3f7;
    font-weight: 600;
}

.metrics-placeholder.error {
    color: #e74c3c;
}
 