/* Reset và 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: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.user-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.user-info label {
    font-weight: 500;
}

.user-info input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Section */
.section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    font-size: 18px;
    color: #2c3e50;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Group Selector */
.group-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.group-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.group-btn:hover {
    border-color: #3498db;
    background: #ebf5fb;
}

.group-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: white;
}

.group-btn.default {
    position: relative;
}

.group-btn.default::after {
    content: "Mặc định";
    position: absolute;
    top: -8px;
    right: -8px;
    background: #27ae60;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Device Selector */
.device-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s;
}

.radio-option:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.radio-option input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.radio-option input[type="text"]:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Settings Form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    flex-wrap: wrap;
}

.setting-item label {
    min-width: 150px;
    font-weight: 500;
    color: #555;
}

.setting-item input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.setting-item button {
    flex-shrink: 0;
}

/* Text Utilities */
.text-muted {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Message */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #2c3e50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 20px;
    }

    .user-info {
        flex-direction: column;
        align-items: stretch;
    }

    .user-info input {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .actions {
        width: 100%;
    }

    .actions button {
        flex: 1;
    }

    .setting-item {
        flex-direction: column;
        align-items: stretch;
    }

    .setting-item label {
        min-width: auto;
    }

    .setting-item input {
        width: 100%;
        min-width: auto;
    }

    .group-selector {
        flex-direction: column;
    }

    .group-btn {
        width: 100%;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }

    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .header, .section {
        padding: 15px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

