* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

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

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

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-header h2 {
    margin-bottom: 0;
}

.stream-id-badge {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.channel-badge {
    background: #17a2b8;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-left: 10px;
}

.video-id-badge {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-left: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
}

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

.btn {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    margin-top: 10px;
    margin-right: 10px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

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

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

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

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.stream-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
}

.stream-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.stream-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    color: white;
    text-align: center;
}

.stream-card-icon {
    font-size: 3.5em;
    margin-bottom: 10px;
}

.stream-card-id {
    font-size: 1.3em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 6px;
}

.stream-card-body {
    padding: 20px;
}

.stream-card-info {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.stream-card-label {
    color: #666;
    font-weight: 600;
}

.stream-card-value {
    color: #333;
    font-weight: 500;
}

.stream-card-status {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
}

.stream-card-status.ACTIVE {
    background: #d4edda;
    color: #155724;
}

.stream-card-status.CREATING {
    background: #fff3cd;
    color: #856404;
}

.stream-card-status.DELETING {
    background: #f8d7da;
    color: #721c24;
}

.stream-card-footer {
    padding: 15px 20px;
    background: #e9ecef;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

.stream-card:hover .stream-card-footer {
    background: #667eea;
    color: white;
}

#video-container {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

#remote-view {
    width: 100%;
    height: auto;
    min-height: 400px;
    max-height: 600px;
    object-fit: contain;
    background: #000;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.status {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-weight: 600;
    color: #333;
}

.status.connected {
    border-left-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.status.error {
    border-left-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navigation */
.main-nav {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 24px;
    font-size: 16px;
    border: 2px solid white;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

/* Dashboard Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 24px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-icon {
    font-size: 3em;
    opacity: 0.9;
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 2em;
    font-weight: 700;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.service-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.service-card-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.service-icon {
    font-size: 2.5em;
}

.service-title {
    flex: 1;
}

.service-name {
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 3px;
}

.service-count {
    font-size: 0.9em;
    opacity: 0.9;
}

.service-card-body {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.service-card-body::-webkit-scrollbar {
    width: 6px;
}

.service-card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.service-card-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.resource-item {
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.2s;
}

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

.resource-item:last-child {
    margin-bottom: 0;
}

.resource-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    word-break: break-all;
}

.resource-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85em;
    color: #666;
}

.resource-tag {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
}

.resource-tag.status-active {
    background: #d4edda;
    color: #155724;
}

.resource-tag.status-running {
    background: #d4edda;
    color: #155724;
}

.resource-tag.status-stopped {
    background: #f8d7da;
    color: #721c24;
}

.resource-tag.status-pending {
    background: #fff3cd;
    color: #856404;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.service-error {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    color: #856404;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .section {
        padding: 20px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .main-nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }
}
