:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #f39c12;
    --success: #27ae60;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --bg: #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, #1a1a2e 100%);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

.subtitle {
    font-size: 1.2em;
    color: var(--secondary);
    font-weight: bold;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Status Section */
.status-section {
    margin-bottom: 30px;
    text-align: center;
}

.status {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.status.connected {
    background: var(--success);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.5);
}

.status.disconnected {
    background: var(--danger);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-connect {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-connect:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(231, 76, 60, 0.3);
}

.btn-connect:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Keypad Grid */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
    flex: 1;
}

.key-btn {
    padding: 20px;
    border: 2px solid var(--secondary);
    background: rgba(243, 156, 18, 0.1);
    color: var(--light);
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    flex-wrap: wrap;
}

.key-btn:hover {
    background: rgba(243, 156, 18, 0.3);
    border-color: var(--secondary);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
}

.key-btn:active {
    transform: scale(0.98);
}

.key-btn[data-key="*"],
.key-btn[data-key="0"],
.key-btn[data-key="#"] {
    grid-column: span 1;
}

/* Shutdown Section */
.shutdown-section {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid var(--danger);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.warning {
    color: var(--secondary);
    font-weight: bold;
    margin: 0;
}

/* Logs */
.logs {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--secondary);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.85em;
    max-height: 150px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

footer {
    margin-top: auto;
    text-align: center;
    padding-top: 20px;
}

/* Responsive */
@media (max-width: 480px) {
    header h1 {
        font-size: 2em;
    }
    
    .keypad-grid {
        gap: 8px;
    }
    
    .key-btn {
        min-height: 70px;
        font-size: 0.8em;
    }
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}

/* Message animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease;
}
