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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1f2937;
    --dark-light: #374151;
    --gray: #6b7280;
    --gray-light: #9ca3af;
    --gray-lighter: #e5e7eb;
    --gray-lightest: #f3f4f6;
    --white: #ffffff;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

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

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-lightest);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    color: var(--dark);
}

/* Icons */
.icon {
    width: 20px;
    height: 20px;
}

.card-icon {
    width: 24px;
    height: 24px;
}

.auth-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--gray-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    background: var(--white);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

.alert-info {
    border-left: 4px solid var(--info);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

.auth-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header svg {
    margin-bottom: 1rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray);
    font-size: 0.95rem;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-lighter);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-lighter);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control:read-only {
    background-color: var(--gray-lightest);
    color: var(--dark);
    cursor: not-allowed;
    border-color: var(--gray-lighter);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.form-control:read-only:focus {
    border-color: var(--gray-lighter);
    box-shadow: none;
}

.help-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray);
}

/* Dashboard */
.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--white);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeInUp 0.4s ease;
}

.card-large {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.5rem;
    background: var(--gray-lightest);
    border-bottom: 1px solid var(--gray-lighter);
}

.card-header h3 {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* File Upload */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-input-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2rem;
    border: 2px dashed var(--gray-lighter);
    border-radius: var(--border-radius-sm);
    background: var(--gray-lightest);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-label:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-text {
    font-weight: 500;
    color: var(--gray);
}

.file-size {
    font-size: 0.875rem;
    color: var(--gray-light);
    font-weight: 400;
}

/* Upload Progress */
.upload-progress-container {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--gray-lightest);
    border-radius: var(--border-radius-sm);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-info span {
    font-weight: 600;
    color: var(--dark);
}

.progress-bar-wrapper {
    width: 100%;
    height: 24px;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.upload-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray);
}

.upload-details span {
    font-weight: 500;
}

/* Video List */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-lightest);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.video-item:hover {
    background: var(--gray-lighter);
    transform: translateX(4px);
}

.video-name {
    font-size: 0.95rem;
    color: var(--dark);
    word-break: break-all;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state p {
    margin-top: 1rem;
    color: var(--gray);
    font-size: 1rem;
}

/* Stream Form */
.stream-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Stream Status */
.card-streaming {
    border: 2px solid var(--success);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-live {
    background: var(--success);
    color: var(--white);
}

.status-offline {
    background: var(--gray-light);
    color: var(--white);
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.pulse-small {
    width: 6px;
    height: 6px;
    background: var(--white);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* Stream List */
.stream-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.stream-item {
    padding: 1.5rem;
    background: var(--gray-lightest);
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--success);
    transition: all 0.2s ease;
}

.stream-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stream-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-lighter);
}

.stream-item-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stream-video-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 1.05rem;
}

.stream-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--success);
    color: var(--white);
}

.stream-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stream-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stream-label {
    font-weight: 600;
    color: var(--gray);
    min-width: 100px;
}

.stream-id {
    font-family: 'Courier New', monospace;
    background: var(--white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
}

.stream-url-text {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--gray);
    word-break: break-all;
}

.stream-stop-form {
    margin-top: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.stream-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--gray-lightest);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
}

.stream-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stream-detail label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stream-value {
    font-size: 1rem;
    color: var(--dark);
    font-weight: 500;
}

.stream-url {
    word-break: break-all;
    font-family: 'Courier New', monospace;
    background: var(--white);
    padding: 8px;
    border-radius: 4px;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--white);
    margin-top: 2rem;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
.video-list::-webkit-scrollbar {
    width: 8px;
}

.video-list::-webkit-scrollbar-track {
    background: var(--gray-lightest);
    border-radius: 4px;
}

.video-list::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

.video-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}
