/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #1a1a1a;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 1px solid #404040;
}

/* Header */
header {
    background: #333;
    color: #fff;
    padding: 30px;
    text-align: center;
    border-bottom: 2px solid #404040;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Work in Progress Banner */
.work-in-progress-banner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid #FF9800;
    border-radius: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.wip-icon {
    font-size: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.wip-text {
    color: #FF9800;
    font-weight: 600;
    font-size: 14px;
}

.info-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease;
}

.info-btn:hover {
    transform: scale(1.2);
}

/* Disclaimer Notice */
.disclaimer-notice {
    background: rgba(255, 152, 0, 0.08);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-left: 4px solid #FF9800;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 15px 0;
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.5;
}

.disclaimer-notice strong {
    color: #FF9800;
    font-weight: 600;
}

/* Form container */
.form-container {
    padding: 30px;
    background: #2d2d2d;
}

.login-section {
    background: #3a3a3a;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #404040;
}

.login-section h2 {
    color: #e0e0e0;
    margin-bottom: 15px;
}

.devices-section {
    background: #3a3a3a;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #404040;
    display: none;
}

.devices-section h2 {
    color: #e0e0e0;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #e0e0e0;
    font-size: 14px;
}

.required {
    color: #ff6b6b;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #404040;
    color: #e0e0e0;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

/* Device cards */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.device-card {
    background: #404040;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 20px 20px 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 170px;
}

.device-card:hover {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.device-card.selected {
    border-color: #4CAF50;
    background: #454545;
}

.device-name {
    font-size: 18px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.device-info {
    color: #b0b0b0;
    font-size: 13px;
    margin-bottom: 3px;
    line-height: 1.3;
}

.device-id {
    color: #888;
    font-size: 11px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #555;
    font-family: monospace;
}

.device-status {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
}

.device-content {
    padding-right: 150px; /* Make room for the larger image */
}

/* Console Button */
.console-btn {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    border-radius: 4px;
    color: #00ff41;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 6px;
    z-index: 10;
}

.console-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    border-color: #00ff41;
    transform: scale(1.1);
}

.console-btn.inline {
    position: relative;
    margin-left: 10px;
    font-size: 12px;
    padding: 2px 4px;
}

.device-card .console-btn {
    bottom: 15px;
    right: 15px;
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.console-icon {
    font-size: 14px;
    line-height: 1;
    font-weight: bold;
}

.device-image {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
    /* Remove padding and use cover to fill the space */
    background: #4a4a4a;
    /* Stronger filters to handle white backgrounds */
    filter: contrast(1.2) brightness(0.75);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.device-card:hover .device-image {
    filter: contrast(1.3) brightness(0.85);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #404040;
    color: #e0e0e0;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-primary {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: #2196F3;
    border-color: #2196F3;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #1976D2;
}

.btn-warning {
    background: #FF9800;
    border-color: #FF9800;
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button[type="submit"]:hover:not(:disabled) {
    background: #45a049;
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #666;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.results, .error {
    padding: 30px;
    background: white;
}

.results h2, .error h2 {
    margin-bottom: 20px;
    color: #333;
}

.result-section {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
}

.result-section h3 {
    margin-bottom: 15px;
    color: #495057;
}

.result-section h4 {
    margin: 20px 0 10px 0;
    color: #666;
}

.success {
    color: #27ae60;
    font-weight: 600;
}

.error {
    color: #e74c3c;
    font-weight: 600;
}

.warning {
    color: #f39c12;
    font-weight: 600;
}

pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.4;
}

ul {
    margin-left: 20px;
    margin-top: 10px;
}

li {
    margin-bottom: 5px;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* Console modal needs higher z-index to appear above firmware modal */
.console-modal {
    z-index: 1100;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: #2d2d2d;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #404040;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    background: #333;
    padding: 20px 30px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #e0e0e0;
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    color: #b0b0b0;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #ff6b6b;
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
    color: #e0e0e0;
}

.modal-footer {
    background: #333;
    padding: 20px 30px;
    border-top: 1px solid #404040;
    text-align: right;
}

.firmware-section {
    background: #3a3a3a;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #555;
}

.firmware-section h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

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

.firmware-detail {
    background: #404040;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #555;
}

.firmware-detail label {
    color: #b0b0b0;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.firmware-detail value {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 600;
}

.release-notes {
    background: #404040;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #555;
    margin-top: 15px;
}

.release-notes h4 {
    color: #2196F3;
    margin-bottom: 10px;
}

.release-notes ul {
    color: #b0b0b0;
    margin-left: 20px;
}

.download-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #555;
}

/* Footer */
footer {
    background: #2d2d2d;
    padding: 30px;
    text-align: center;
    color: #b0b0b0;
    border-top: 1px solid #404040;
    margin-top: 20px;
}

footer p {
    margin-bottom: 10px;
}

.author-info {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #555;
    border-bottom: 1px solid #555;
}

.author-info a {
    color: #4CAF50;
    text-decoration: none;
}

.author-info a:hover {
    text-decoration: underline;
}

.version-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #555;
    font-size: 12px;
    color: #888;
}

.version-info a {
    color: #4CAF50;
    text-decoration: none;
}

.version-info a:hover {
    text-decoration: underline;
}

/* Translation styling */
.release-notes-content {
    margin-bottom: 15px;
}

.original-text {
    margin-bottom: 10px;
    padding: 10px;
    background: #3a3a3a;
    border-left: 3px solid #FF9800;
    border-radius: 4px;
}

.translation-section {
    margin-top: 10px;
    padding: 10px;
    background: #2d4a2d;
    border-left: 3px solid #4CAF50;
    border-radius: 4px;
}

.translated-text {
    color: #e0e0e0;
    margin-bottom: 5px;
}

.translation-note {
    color: #b0b0b0;
    font-style: italic;
}

.translate-btn {
    margin-top: 10px;
    font-size: 12px;
    padding: 8px 12px;
}

.translate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 30px 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-container,
    .results,
    .error {
        padding: 20px;
    }
    
    .advanced-options {
        padding: 20px;
    }
    
    button[type="submit"] {
        padding: 14px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .form-container,
    .results,
    .error,
    footer {
        padding: 15px;
    }
    
    .advanced-options {
        padding: 15px;
    }
}