/**
 * Tonex One Web Controller - Styles
 *
 * Mobile-friendly styling for Android devices
 */

/* 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;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    padding: 20px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Main content */
main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
}

/* Connection section */
.connection-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.connection-status {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
}

.connection-status.disconnected {
    background: rgba(255, 100, 100, 0.3);
}

.connection-status.connected {
    background: rgba(100, 255, 100, 0.3);
}

.device-info {
    font-size: 0.9rem;
}

.device-info p {
    margin-bottom: 5px;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

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

.btn-primary:hover:not(:disabled) {
    background: #45a049;
}

.btn-secondary {
    background: #f44336;
    color: white;
}

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

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

/* Preset section */
.preset-info {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    margin-bottom: 15px;
}

.preset-info p {
    font-size: 1.1rem;
}

.preset-buttons h3 {
    font-size: 1.1rem;
    margin: 10px 0;
    opacity: 0.9;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.preset-btn {
    padding: 15px 5px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

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

.preset-btn.active {
    background: #4CAF50;
    border-color: #4CAF50;
    font-weight: bold;
}

/* Status section */
.status-log {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    font-family: monospace;
    font-size: 0.85rem;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
}

.log-info {
    color: #81d4fa;
}

.log-success {
    color: #a5d6a7;
}

.log-error {
    color: #ef9a9a;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 10px;
    font-size: 0.8rem;
    opacity: 0.7;
}

footer p {
    margin-bottom: 5px;
}

/* Responsive design */
@media (max-width: 500px) {
    body {
        padding: 5px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .connection-section {
        grid-template-columns: 1fr;
    }

    .preset-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .preset-btn {
        padding: 12px 3px;
        font-size: 0.85rem;
    }

    .card {
        padding: 12px;
    }

    .card h2 {
        font-size: 1.1rem;
    }
}

@media (max-width: 350px) {
    .preset-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Touch-friendly adjustments */
@media (pointer: coarse) {
    .preset-btn {
        min-height: 50px;
    }

    .btn {
        min-height: 50px;
        font-size: 1.1rem;
    }
}

/* Loading state */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s infinite;
}