/* --- Layout & Reset --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrolling */
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    color: #22223b;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
}

header .img-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    padding: 20px 0;
    gap: 32px;
    width: 100%;
    height: 100px;
}

header .img-container img {
    height: 80px;
    width: auto;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(60, 72, 88, 0.08);
    padding: 4px 12px;
}

h1 {
    text-align: center;
    margin: 12px 0 16px 0;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #3a3a5a;
}

/* --- Main Layout --- */
.dashboard-main {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 100px); /* header height */
    width: 100vw;
    gap: 16px;
    padding: 0 16px 0 16px;
    box-sizing: border-box;
    position: relative;
    overflow: auto;
}

.dashboard-columns {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    gap: 16px;
    min-width: 0;
    overflow: auto;
}

.dashboard-row {
    display: flex;
    flex-direction: row;
    gap: 16px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    max-height: 50%; /* Half of current size */
}

.column {
    background: #f1f5f9;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(60, 72, 88, 0.08);
    padding: 18px 14px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    max-height: 100%;
}

.column h2 {
    margin-bottom: 10px;
    color: #6366f1;
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
}

label {
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
    flex-shrink: 0;
}

input, select, textarea {
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 1rem;
    margin-bottom: 12px;
    width: 100%;
    background: #fff;
    transition: border 0.2s;
    flex-shrink: 0;
}

input:focus, select:focus, textarea:focus {
    border-color: #6366f1;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

button, .btn {
    background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    transition: background 0.2s, transform 0.1s;
    outline: none;
    margin-bottom: 8px;
    flex-shrink: 0;
}

button:hover, .btn:hover {
    background: linear-gradient(90deg, #818cf8 0%, #38bdf8 100%);
    transform: translateY(-2px) scale(1.03);
}

button:active, .btn:active {
    background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
    transform: scale(0.98);
}

/* --- STOP button in red --- */
button.stop-btn {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    color: #fff;
    font-weight: 700;
}

button.stop-btn:hover {
    background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
    transform: translateY(-2px) scale(1.03);
}

/* --- Make pre elements resizable and scrollable --- */
pre {
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: auto;
    font-size: 0.97rem;
    margin-bottom: 8px;
    min-height: 80px;
    max-height: 400px;
    flex: 1 1 0;
    resize: both;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background: #e0e7ff;
    color: #3a3a5a;
    font-weight: 600;
}

.results-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
    margin: 10px 0;
    padding: 10px;
    background: #e9ecef;
    overflow: auto;
    box-sizing: border-box;
    border-radius: 12px;
    flex: 1 1 0;
    resize: both;
    max-height: 500px;
}

.results-container embed {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Stream in lower right --- */
#stream-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 340px;
    height: 220px;
    z-index: 1000;
    background: #18181b;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(60, 72, 88, 0.18);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    padding: 8px;
    resize: both;
    overflow: hidden;
    min-width: 200px;
    min-height: 150px;
    max-width: 600px;
    max-height: 400px;
}

#stream-container h2 {
    color: #fff;
    font-size: 1rem;
    margin: 0 0 4px 0;
    padding: 0 0 0 8px;
    flex-shrink: 0;
}

#videoPlayer {
    width: 100%;
    height: calc(100% - 20px);
    border-radius: 8px;
    background: #000;
    box-shadow: 0 2px 8px rgba(60, 72, 88, 0.08);
    margin: 0;
    object-fit: cover;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .dashboard-main {
        flex-direction: column;
        height: auto;
        min-height: 0;
        padding: 0 4px;
        overflow: auto;
    }
    .dashboard-row {
        max-height: none; /* Remove height restriction on mobile */
    }
    #stream-container {
        width: 98vw;
        left: 1vw;
        right: 1vw;
        bottom: 8px;
        height: 180px;
    }
}

@media (max-width: 900px) {
    .dashboard-row {
        flex-direction: column;
        gap: 8px;
        max-height: none; /* Remove height restriction on mobile */
    }
    .dashboard-main {
        padding: 0 2px;
        overflow: auto;
    }
    #stream-container {
        width: 98vw;
        left: 1vw;
        right: 1vw;
        bottom: 8px;
        height: 140px;
    }
    pre {
        min-height: 60px;
        max-height: 200px;
        resize: both;
    }
}