* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

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

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

.connection-status {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1.1rem;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-connected {
    background-color: #4CAF50;
}

.status-disconnected {
    background-color: #f44336;
}

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

.device-panel, .queue-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.panel-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    color: #333;
    font-size: 1.3rem;
}

.device-list {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.device-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #007bff;
}

.device-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.device-item.active {
    background: #e3f2fd;
    border-left-color: #4CAF50;
}

.device-info {
    font-weight: 500;
    color: #333;
}

.device-status {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.no-devices {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.control-panel {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 20px;
}

.screen-area {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.screen-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.screen-header h2 {
    color: #333;
    font-size: 1.3rem;
}

.device-dropdown {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

.screen-container {
    position: relative;
    height: 640px;
    width: 360px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.screen-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.screen-content {
    text-align: center;
    color: #666;
}

.phone-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.touch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
}

.screen-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 5;
}

.controls-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.control-group {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 20px;
}

.control-group h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.control-btn {
    width: 100%;
    margin-bottom: 10px;
}

.nav-controls, .touch-controls, .volume-controls, .power-controls {
    display: grid;
    gap: 10px;
}

.nav-btn, .vol-btn, .power-btn {
    padding: 15px;
    font-size: 1rem;
}

.text-input-area {
    display: flex;
    gap: 10px;
}

.text-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #667eea;
}

.status-bar {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 20px;
    min-height: 60px;
}

.status-messages {
    color: #666;
    font-size: 0.9rem;
}

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

    .device-panel {
        order: 2;
    }

    .control-panel {
        order: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .screen-container {
        height: 480px;
        width: 270px;
    }
}

/* Touch feedback */
.device-item, .btn {
    -webkit-tap-highlight-color: transparent;
}

.btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

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

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Touch points visualization */
.touch-point {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(102, 126, 234, 0.3);
    border: 2px solid #667eea;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
}

.touch-point.active {
    background: rgba(102, 126, 234, 0.6);
    transform: translate(-50%, -50%) scale(1.2);
}

/* Queue-specific styles */
.queue-status {
    padding: 20px;
    min-height: 200px;
}

.queue-info {
    text-align: center;
}

.queue-position h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
}

.queue-position p {
    color: #666;
    margin-bottom: 10px;
    font-size: 1rem;
}

.queue-info.active-user {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border-radius: 10px;
    padding: 20px;
}

.queue-info.active-user h3 {
    color: white;
    font-size: 1.8rem;
}

.queue-info.active-user p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

.timer {
    background: #ff9800;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
}

.timer.warning {
    background: #f44336;
    animation: pulse 1s ease-in-out infinite;
}

#queue-timer {
    font-size: 1.2em;
    font-weight: bold;
}

/* Queue button styles */
.btn.queue-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    min-width: 120px;
}

.btn.queue-btn:hover {
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn.leave-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.btn.leave-btn:hover {
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

/* Responsive updates for queue layout */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .queue-panel {
        order: 2;
    }

    .control-panel {
        order: 1;
    }
}

@media (max-width: 768px) {
    .panel-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .panel-header h2 {
        text-align: center;
    }

    .queue-position h3 {
        font-size: 1.3rem;
    }

    .timer {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
