/* Main application styling */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Console panel styling */
.console-panel {
    width: 30%;
    background-color: #1e1e1e;
    color: #f8f8f8;
    padding: 10px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    order: 2; /* Place console on the right */
    font-family: 'Courier New', monospace;
    transition: transform 0.3s ease, width 0.3s ease;
    position: relative;
}

.console-toggle {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background-color: #333;
    border: 1px solid #666;
    border-right: none;
    border-radius: 5px 0 0 5px;
    color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    z-index: 1000;
    box-shadow: -3px 0 5px rgba(0,0,0,0.3);
}

.console-toggle:hover {
    background-color: #333;
}

.console-toggle-alt {
    background-color: #333;
    color: white;
    border: 1px solid #666;
    border-radius: 4px;
    padding: 5px 10px;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: pointer;
    display: block;
    width: auto;
    text-align: center;
}

.console-toggle-alt:hover {
    background-color: #555;
}

.console-panel.collapsed {
    transform: translateX(100%);
    width: 0;
    padding: 0;
    border: none;
}

/* Main content area styling */
.main-content {
    width: 70%;
    height: 100vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    order: 1; /* Place main content on the left */
    transition: width 0.3s ease;
}

.main-content.expanded {
    width: 100%;
}

/* Console log styling */
.console-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    line-height: 1.2;
}

.console-log .log-entry {
    margin: 0;
    padding: 0;
    border: none;
    display: block;
}

.console-log .log-separator {
    margin: 5px 0;
}

.console-log .log-separator hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(150, 150, 150, 0), rgba(150, 150, 150, 0.75), rgba(150, 150, 150, 0));
}

.console-log .log-time {
    color: #999;
    margin-right: 8px;
}

.console-log .log-info {
    color: #6ab0ff;
}

.console-log .log-warn {
    color: #ffd600;
}

.console-log .log-error {
    color: #ff6b6b;
}

.console-log .log-success {
    color: #4caf50;
}

/* Danger box (for showing potentially unsafe output) */
.danger-box {
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    border: 2px solid black;
    max-width: 100%;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    max-height: 300px;
    overflow-y: auto;
}

.danger-box.unsafe {
    background-color: #ff0000;
    color: white;
}

.danger-box.safe {
    background-color: #2b2b2b;
    color: #f8f8f8;
}

.danger-header {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.blink {
    animation: blink 1s linear infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.warning-icon:before {
    content: "⚠️ ";
}

pre {
    white-space: pre-wrap;
    font-family: monospace;
    margin: 0;
    font-size: 12px;
}

/* Inference section styling */
.inference-box {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 5px;
    padding: 15px;
    margin-top: 20px;
    max-width: 100%;
}

.inference-title {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.inference-data {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
}

.inference-step {
    background-color: #f9f9f9;
    border-left: 4px solid #1890ff;
    padding: 10px 15px;
    margin: 15px 0;
}

/* Form styling */
.form-container {
    margin-top: 30px;
    max-width: 100%;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.form-heading {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.form-description {
    margin-bottom: 20px;
    color: #555;
}

.pattern-options {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.pattern-option {
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    width: 150px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.pattern-option:hover {
    border-color: #1890ff;
    background-color: #e6f7ff;
}

.pattern-option.selected {
    border-color: #1890ff;
    background-color: #e6f7ff;
}

.pattern-img {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
}

.submit-button {
    background-color: #1890ff;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

.submit-button:hover {
    background-color: #40a9ff;
}

/* Model explanation styling */
.model-explanation {
    background-color: #f0f8ea;
    border-left: 4px solid #52c41a;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 5px 5px 0;
}

.explanation-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #135200;
}

.number-prediction {
    font-size: 42px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    color: #1890ff;
}

.image-preview {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.image-canvas {
    border: 1px solid #ddd;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.unsafe-warning {
    background-color: #fff2e8;
    border-left: 4px solid #fa541c;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 5px 5px 0;
}

/* Persistent toggle button styling */
.persistent-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 2000;
}

.persistent-toggle button {
    width: 30px;
    height: 60px;
    background-color: #333;
    border: 1px solid #666;
    border-right: none;
    border-radius: 5px 0 0 5px;
    color: #f8f8f8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -3px 0 5px rgba(0,0,0,0.3);
}

.persistent-toggle button:hover {
    background-color: #555;
}

#toggle-arrow {
    font-size: 18px;
    font-weight: bold;
}

/* Responsive styling */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .console-panel, .main-content {
        width: 100%;
        height: auto;
    }
    .console-panel {
        height: 300px;
        order: 2;
    }
    .main-content {
        order: 1;
    }
}