/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 25%, #2d1b69 50%, #1a1a3a 75%, #0a0a1a 100%);
    min-height: 100vh;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

.header-content h1 i {
    margin-right: 0.5rem;
    color: #667eea;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
}

.header-content p {
    font-size: 1.2rem;
    color: #b8b8b8;
    font-weight: 300;
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Device info */
.device-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

.device-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.device-details span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b8b8b8;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.device-details span:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.device-details i {
    color: #667eea;
    font-size: 1rem;
    filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3));
}

/* Main content - Two column layout */
.main-content {
    flex: 1;
    display: flex;
    gap: 40px;
    margin-top: 40px;
}

/* Room creation section */
.room-creation {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    height: fit-content;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.room-creation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.room-creation h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.room-creation h2 i {
    color: #667eea;
    filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3));
}

.room-creation p {
    color: #b8b8b8;
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #888;
}

/* Button styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Rooms list */
.rooms-section {
    flex: 2;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.rooms-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.rooms-section h2 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.rooms-section h2 i {
    color: #667eea;
    filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.3));
}

.rooms-section p {
    color: #b8b8b8;
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.rooms-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr;
}

.room-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.room-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.room-info {
    flex: 1;
}

.room-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #ffffff;
}

.room-details {
    display: flex;
    gap: 20px;
    color: #a0a0a0;
    font-size: 0.9rem;
}

.room-details span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.room-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Empty state */
.empty-rooms {
    text-align: center;
    padding: 60px 20px;
    color: #a0a0a0;
}

.empty-rooms i {
    font-size: 4rem;
    color: rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.2));
}

.empty-rooms p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 20px auto;
    padding: 0;
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.modal-header {
    padding: 25px 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: #667eea;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #a0a0a0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: rotate(90deg);
}

.modal form {
    padding: 25px 30px 30px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 40px;
    color: #a0a0a0;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #667eea;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animation for room cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.room-card {
    animation: fadeInUp 0.5s ease forwards;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .header {
        padding: 20px 0;
        margin-bottom: 20px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    .room-creation,
    .rooms-section {
        padding: 20px;
    }
    
    .room-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .room-actions {
        width: 100%;
        justify-content: center;
    }
    
    .room-details {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .device-info {
        padding: 10px 12px;
    }
    
    .device-details {
        gap: 10px;
        flex-direction: column;
    }
    
    .device-details span {
        font-size: 0.75rem;
    }
    
    .modal-content {
        margin: 10px auto;
        width: 95%;
        max-width: 400px;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 20px 20px 0;
    }
    
    .modal form {
        padding: 20px 20px 25px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .header-content p {
        font-size: 0.9rem;
    }
    
    .room-creation,
    .rooms-section {
        padding: 15px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .room-card {
        padding: 12px;
    }
    
    .room-name {
        font-size: 1rem;
    }
    
    .room-details {
        font-size: 0.8rem;
    }
    
    .device-info {
        padding: 10px 12px;
    }
    
    .device-details {
        gap: 10px;
        flex-direction: column;
    }
    
    .device-details span {
        font-size: 0.75rem;
    }
    
    .modal-content {
        margin: 5px auto;
        width: 98%;
        max-height: 80vh;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Focus states for accessibility */
.btn:focus,
input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced hover effects */
.room-card:hover .room-name {
    color: #667eea;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.device-details span:hover i {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.5));
}

/* Loading animation for buttons */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
