/* MIMICA - Main Stylesheet */

:root {
    --primary-color: #00ff88;
    --secondary-color: #00aaff;
    --background-color: #1a1a1a;
    --surface-color: #2a2a2a;
    --text-color: #f0f0f0;
    --error-color: #ff4d4d;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1rem;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #aaa;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.loading-message, .error-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    text-align: center;
    padding: 1rem;
}

.error-message {
    color: var(--error-color);
}

.controls-panel {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: #ccc;
}

.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--background-color);
}
.btn-primary:hover {
    background-color: #33ffaa;
}

.btn-secondary {
    background-color: #555;
    color: var(--text-color);
}
.btn-secondary:hover {
    background-color: #777;
}

select, input[type="range"], input[type="checkbox"] {
    accent-color: var(--primary-color);
}

select {
    width: 100%;
    padding: 0.5rem;
    background-color: #333;
    color: var(--text-color);
    border: 1px solid #555;
    border-radius: 5px;
}

.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
    z-index: 1000;
}

.install-content {
    text-align: center;
}

.install-buttons {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    color: #aaa;
}

.footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}
/* --- Recording Styles --- */
.recording-section {
    background-color: rgba(0, 255, 136, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
}

.recording-section #record-btn.recording {
    background-color: var(--error-color);
}

#download-area {
    margin-top: 0.5rem;
}

#download-link {
    display: block;
    text-align: center;
    background-color: var(--secondary-color);
}

.recording-indicator {
    color: var(--error-color);
    margin-left: 0.5rem;
    font-weight: bold;
    animation: blink-animation 1.5s steps(2, start) infinite;
}

@keyframes blink-animation {
    to {
        visibility: hidden;
    }
}

/* Add this to the end of styles.css */
#download-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#download-area a {
    width: 100%;
}

/* Add this to the end of styles.css */
.stats span {
    min-width: 120px;
    text-align: right;
}
/* --- New UI Element Styles --- */

/* Fullscreen Button */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background-color: rgba(42, 42, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    padding: 6px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-btn svg {
    width: 100%;
    height: 100%;
    fill: #f0f0f0;
}

/* Collapsible Control Sections */
.control-section {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
}

.control-section[open] {
    background-color: rgba(0,0,0,0.2);
}

.control-section summary {
    font-weight: bold;
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--primary-color);
}

.control-section > div {
    margin-top: 1rem;
}

.control-section[open] > *:not(summary) {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* --- Mobile Responsive Fixes --- */
@media (max-width: 768px) {
    .main-content {
        /* Switch to a single column layout on small screens */
        grid-template-columns: 1fr;
    }

    .controls-panel {
        /* Allow the panel to shrink */
        width: 100%;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        width: 100%;
    }
    
    .stats span {
        min-width: unset; /* Allow stat items to wrap freely */
        text-align: left;
    }
}

/* --- New UI Element Styles --- */

/* Fullscreen Button */
.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background-color: rgba(42, 42, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    padding: 6px;
    opacity: 0.5;
    transition: opacity 0.2s;
    z-index: 10;
}

.fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-btn svg {
    width: 100%;
    height: 100%;
    fill: #f0f0f0;
}

/* Collapsible Control Sections */
.control-section {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
}

.control-section[open] {
    background-color: rgba(0,0,0,0.2);
}

.control-section summary {
    font-weight: bold;
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--primary-color);
}

.control-section > div {
    margin-top: 1rem;
}

.control-section[open] > *:not(summary) {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* --- Mobile Responsive Fixes --- */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        width: 100%;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        width: 100%;
    }
    
    .stats span {
        min-width: unset;
        text-align: left;
    }
}

/* --- Recording & Download Styles --- */
.recording-section {
    background-color: rgba(0, 255, 136, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
}

.recording-section #record-btn.recording {
    background-color: var(--error-color);
}

#download-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#download-area a {
    width: 100%;
    text-align: center;
}

#download-link-video {
    background-color: var(--secondary-color);
}
#download-link-json {
    background-color: #f0ad4e; /* Orange for data */
    color: var(--background-color);
}

.recording-indicator {
    color: var(--error-color);
    margin-left: 0.5rem;
    font-weight: bold;
    animation: blink-animation 1.5s steps(2, start) infinite;
}

@keyframes blink-animation {
    to {
        visibility: hidden;
    }
}
/* --- Status Indicator Styles --- */
.status-indicator {
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

.status-not-loaded { background-color: #6c757d; }
.status-loading { background-color: #ffc107; color: #000; }
.status-ready { background-color: #28a745; }
.status-error { background-color: #dc3545; }

/* Ensure label is a flex container for alignment */
.control-group label {
    display: flex;
    align-items: center;
    width: 100%;
}

/* --- OCR Status Styles --- */
#ocr-status-text {
    font-size: 0.9rem;
    color: #ccc;
    margin-top: 0.5rem;
    text-align: center;
}


/* --- Info Text Styles --- */
.info-text {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: rgba(0,0,0,0.2);
    border-radius: 4px;
    line-height: 1.4;
}

/* --- System Info Styles --- */
.system-info {
    font-size: 0.75rem;
    color: #888;
    margin-top: 1rem;
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 1rem;
}

.system-info span {
    margin: 0 0.5rem;
}
