:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 500px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 .icon {
    font-size: 1.5rem;
}

/* QR Code Section */
#qr-section {
    text-align: center;
}

#qr-code {
    display: inline-block;
    padding: 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 2px solid #e5e7eb;
}

#qr-code canvas {
    display: block;
}

#qr-info {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
    text-align: left;
    background: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
    word-break: break-all;
}

/* Status Section */
.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-weight: 500;
}

.status-value {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.success {
    background: var(--success-color);
}

.status-indicator.warning {
    background: var(--warning-color);
}

.status-indicator.error {
    background: var(--error-color);
}

.status-indicator.loading {
    background: var(--text-light);
    animation: pulse 1.5s infinite;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #e5e7eb;
    color: var(--text-color);
}

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

/* Device Name Input */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Install Prompt - Always visible until installed */
#install-prompt {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 3px solid #f59e0b;
    animation: pulse-border 2s ease-in-out infinite;
}

#install-prompt.visible {
    display: block;
}

#install-prompt:not(.visible) {
    display: none;
}

@keyframes pulse-border {
    0%, 100% { border-color: #f59e0b; }
    50% { border-color: #d97706; }
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

footer a {
    color: white;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 16px;
    }
}

/* Animation for QR refresh */
@keyframes fadeInOut {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.qr-refreshing {
    animation: fadeInOut 0.3s ease;
}
