/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e2e8f0;
    line-height: 1.6;
}

/* Container and Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid #475569;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.2;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 15px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    font-weight: 400;
}

/* Controls Section */
.controls {
    padding: 30px;
    background: linear-gradient(145deg, #334155 0%, #475569 100%);
    border-bottom: 1px solid #64748b;
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.input-group input {
    flex: 1;
    min-width: 300px;
    padding: 15px 20px;
    border: 2px solid #64748b;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #1e293b;
    color: #e2e8f0;
    font-weight: 500;
}

.input-group input::placeholder {
    color: #94a3b8;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
    background: #0f172a;
}

/* Advanced Controls */
.advanced-controls {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #475569;
}

.control-section {
    margin-bottom: 30px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h4 {
    color: #e2e8f0;
    margin-bottom: 20px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.9em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.setting-item input {
    padding: 10px 15px;
    border: 2px solid #475569;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #0f172a;
    color: #e2e8f0;
}

.setting-item input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: #1e293b;
}

/* Sandbox Options */
.sandbox-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sandbox-attributes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding: 20px;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    border-radius: 10px;
    border: 1px solid #334155;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Custom Checkbox Styles */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    color: #cbd5e1;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
    user-select: none;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid transparent;
}

.checkbox-container:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #475569;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    background: #1e293b;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(145deg, #3b82f6 0%, #1e40af 100%);
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Button Styles */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
    background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ff9500, #ff6b35);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ff8a00, #ff5a1f);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Status Messages */
.status {
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    font-weight: 600;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.status.success {
    background: linear-gradient(145deg, #065f46 0%, #047857 100%);
    color: #d1fae5;
    border-left-color: #10b981;
}

.status.error {
    background: linear-gradient(145deg, #7f1d1d 0%, #991b1b 100%);
    color: #fee2e2;
    border-left-color: #ef4444;
}

.status.info {
    background: linear-gradient(145deg, #1e40af 0%, #3b82f6 100%);
    color: #dbeafe;
    border-left-color: #60a5fa;
}

/* Content Layout */
.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

.iframe-section, .logs-section {
    background: linear-gradient(145deg, #334155 0%, #475569 100%);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #64748b;
}

.iframe-section h3, .logs-section h3 {
    margin-bottom: 20px;
    color: #e2e8f0;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Iframe Container */
.iframe-container {
    width: 100%;
    height: 600px;
    max-width: 1200px;
    border: 3px solid #475569;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    transition: all 0.3s ease;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
    /* Allow resizing */
    resize: both;
    min-width: 200px;
    min-height: 200px;
    margin: 0 auto;
}

.iframe-container:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2), inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    min-width: 100%;
    min-height: 100%;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    text-align: center;
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.6;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.placeholder p {
    font-size: 1.1em;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Logs Section */
.logs {
    max-height: 500px;
    overflow-y: auto;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid #334155;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

.logs::-webkit-scrollbar {
    width: 8px;
}

.logs::-webkit-scrollbar-track {
    background: #334155;
    border-radius: 4px;
}

.logs::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
    border: 1px solid #64748b;
}

.logs::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.log-entry {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.log-entry.info {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left-color: #3b82f6;
}

.log-entry.success {
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-left-color: #22c55e;
}

.log-entry.error {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-left-color: #ef4444;
}

.log-entry.warning {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left-color: #f59e0b;
}

.timestamp {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .iframe-container, .logs {
        height: 400px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2.2em;
    }
    
    .controls {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .sandbox-attributes {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .content {
        padding: 20px;
    }
    
    .iframe-section, .logs-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    .header p {
        font-size: 1em;
    }
    
    .advanced-controls {
        padding: 20px;
    }
    
    .control-section h4 {
        font-size: 1em;
    }
}



/* Iframe Messages section */
.iframe-messages-section {
    background: linear-gradient(145deg, #334155 0%, #475569 100%);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #64748b;
    margin-bottom: 1.5rem;
}

.iframe-messages-section h3 {
    margin: 0 0 1rem 0;
    color: #e2e8f0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.iframe-messages {
    max-height: 300px;
    overflow-y: auto;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 2px solid #334155;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

.iframe-message-entry {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid #3b82f6;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    border: 1px solid #64748b;
}

.iframe-message-entry:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.iframe-message-entry .timestamp {
    color: #94a3b8;
    font-weight: 600;
    margin-right: 0.5rem;
}

.iframe-message-entry .origin {
    color: #3b82f6;
    font-weight: 600;
    margin-right: 0.5rem;
}

.iframe-message-entry .source {
    color: #f59e0b;
    font-weight: 600;
    margin-right: 0.5rem;
}

.iframe-message-entry .data {
    color: #e2e8f0;
    word-break: break-word;
}

.iframe-message-entry .data-type {
    color: #94a3b8;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Popup Messages section */
.popup-messages-section {
    background: linear-gradient(145deg, #334155 0%, #475569 100%);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #64748b;
    margin-bottom: 1.5rem;
}

.popup-messages-section h3 {
    margin: 0 0 1rem 0;
    color: #e2e8f0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.popup-messages {
    max-height: 300px;
    overflow-y: auto;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 2px solid #334155;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

.popup-message-entry {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid #10b981;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    border: 1px solid #64748b;
}

.popup-message-entry:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.popup-message-entry .timestamp {
    color: #94a3b8;
    font-weight: 600;
    margin-right: 0.5rem;
}

.popup-message-entry .origin {
    color: #10b981;
    font-weight: 600;
    margin-right: 0.5rem;
}

.popup-message-entry .source {
    color: #f59e0b;
    font-weight: 600;
    margin-right: 0.5rem;
}

.popup-message-entry .data {
    color: #e2e8f0;
    word-break: break-word;
}

.popup-message-entry .data-type {
    color: #94a3b8;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.25rem;
}
