/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    overflow-x: hidden;
}

/* Broadcast Container */
.broadcast-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.broadcast-header {
    background: linear-gradient(90deg, #8e44ad 0%, #c0392b 100%);
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.broadcast-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    opacity: 0.5;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2.5rem;
    color: #f1c40f;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 800;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.5);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    border: 2px solid #f1c40f;
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #2ecc71;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    font-weight: 700;
    font-size: 1rem;
}

/* Control Panel */
.control-panel {
    background: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1rem;
    border-radius: 20px;
    padding: 2rem;
    max-width: 450px;
    position: fixed;
    top: 120px;
    left: 1rem;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.panel-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #f1c40f;
}

.add-stream-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.add-stream-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.5);
}

/* Notification Controls */
.notification-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

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

.notification-btn.test {
    background: linear-gradient(45deg, #e67e22, #d35400);
    border-color: #e67e22;
}

.notification-btn.test:hover {
    box-shadow: 0 5px 20px rgba(230, 126, 34, 0.4);
}

.notification-btn.config {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    border-color: #9b59b6;
}

.notification-btn.config:hover {
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.4);
}

/* Telegram Configuration Modal */
.config-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.config-section h3 {
    color: #3498db;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.config-section p {
    margin-bottom: 0.5rem;
    color: #bdc3c7;
}

.config-section ol {
    margin-left: 1.5rem;
    color: #bdc3c7;
}

.config-section li {
    margin-bottom: 0.5rem;
}

.config-section code {
    background: rgba(52, 152, 219, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    color: #3498db;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.input-group label {
    font-weight: 700;
    color: #f1c40f;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.test-btn {
    background: linear-gradient(45deg, #e67e22, #d35400);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.test-btn:hover {
    transform: translateY(-2px);
}

.config-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.save-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.save-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.4);
}

.reset-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.chat-id-help {
    background: rgba(52, 152, 219, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.auto-detect-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.auto-detect-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.4);
}

/* Stream List */
.stream-list {
    max-height: 450px;
    overflow-y: auto;
}

.stream-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.stream-item:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: translateX(10px);
}

.stream-info {
    flex: 1;
}

.stream-name {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #3498db;
}

.stream-url {
    font-size: 0.9rem;
    opacity: 0.6;
    word-break: break-all;
}

.stream-controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.remove {
    background: rgba(231, 76, 60, 0.5);
}

.control-btn.remove:hover {
    background: rgba(231, 76, 60, 0.7);
}

/* Video Grid */
.video-grid {
    margin-left: 470px;
    margin-right: 1rem;
    margin-top: 1rem;
    display: grid;
    gap: 1.5rem;
    min-height: calc(100vh - 220px);
    transition: all 0.3s ease;
}

.video-grid.grid-1 { grid-template-columns: 1fr; }
.video-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.video-grid.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.grid-6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.video-grid.grid-24 { grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: repeat(6, 1fr); }

.video-player {
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.video-player:hover {
    transform: scale(1.03);
    border-color: #3498db;
}

.video-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 2rem;
}

.video-overlay i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
    color: #f1c40f;
}

.video-overlay h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.video-overlay p {
    opacity: 0.6;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 20px;
    padding: 3rem;
    min-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.8rem;
    color: #f1c40f;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1.1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.3);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.modal-footer {
    display: flex;
    gap: 1.5rem;
    justify-content: flex-end;
    margin-top: 2.5rem;
}

.btn-primary,
.btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.5);
}

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

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

/* Layout Controls */
.layout-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    background: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(15px);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.layout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.layout-btn:hover,
.layout-btn.active {
    background: linear-gradient(45deg, #3498db, #2980b9);
    border-color: #3498db;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .control-panel {
        position: relative;
        max-width: none;
        margin: 1rem;
        top: auto;
        left: auto;
    }
    
    .video-grid {
        margin-left: 1rem;
    }
}

@media (max-width: 768px) {
    .broadcast-header {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.6rem;
    }
    
    .video-grid {
        grid-template-columns: 1fr !important;
        margin: 1rem;
    }
    
    .layout-controls {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 1rem;
        justify-content: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.7);
}
