/* 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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo h1 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

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

.input-group .icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #7f8c8d;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

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

.error {
    color: #e74c3c;
    margin-top: 15px;
    padding: 10px;
    background: #fdf2f2;
    border-radius: 5px;
    border-left: 4px solid #e74c3c;
    display: none;
}

.error:not(:empty) {
    display: block;
}

/* Dashboard Styles */
.dashboard {
    min-height: 100vh;
    background: #f8f9fa;
}

.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: #667eea;
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

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

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Content Sections */
.content-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.section-header {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 20px;
}

.section-content {
    padding: 20px 30px;
}

/* Drama List */
.drama-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.drama-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

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

.drama-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.drama-info {
    flex: 1;
}

.drama-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.drama-meta {
    color: #7f8c8d;
    font-size: 14px;
}

.drama-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: #5a67d8;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

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

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

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

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

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Modal Styles - Larger popup box */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 800px; /* Increased from 600px */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px 30px 20px 30px; /* Increased padding */
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
    font-size: 22px; /* Slightly larger title */
}

/* Add proper padding to form content */
.modal-content form {
    padding: 35px; /* Increased from default */
}

/* Better form spacing */
.form-group {
    margin-bottom: 25px; /* Increased spacing */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%; /* Use more screen width on mobile */
        margin: 10px;
    }
    
    .modal-header {
        padding: 20px 25px 15px 25px;
    }
    
    .modal-content form {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 100%;
        margin: 5px;
    }
    
    .modal-header {
        padding: 15px 20px 12px 20px;
    }
    
    .modal-content form {
        padding: 20px;
    }
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #e74c3c;
}

/* Video Input Toggle Improvements */
.video-input-toggle {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.radio-option:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.radio-option input[type="radio"] {
    margin: 0;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #007bff;
    background: #007bff;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Form Group Spacing */
.form-group {
    margin-bottom: 25px;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Enhanced Form Styling for Episode Management */
.form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Form Actions Spacing */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.form-actions .btn {
    min-width: 100px;
    padding: 12px 20px;
}

/* File Input Improvements */
input[type="file"] {
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

input[type="file"]:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

input[type="file"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Video File Group Transitions */
#videoFileGroup {
    transition: all 0.3s ease;
}

#videoFileGroup.show {
    display: block !important;
    opacity: 1;
}

#videoFileGroup.hide {
    display: none !important;
    opacity: 0;
}

/* Form Grid Spacing */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .radio-option {
        min-width: auto;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 12px;
}

/* Success/Error Messages */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #28a745;
    margin-bottom: 20px;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #dc3545;
    margin-bottom: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .section-header {
        padding: 15px 20px;
        flex-direction: column;
        text-align: center;
    }
    
    .section-content {
        padding: 15px 20px;
    }
    
    .drama-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .drama-actions {
        justify-content: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .stat-number {
        font-size: 28px;
    }
}

/* Episode Management Styles */
.episode-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
}

.episode-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.episode-info {
    flex: 1;
    margin-right: 20px;
}

.episode-info h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.episode-info p {
    margin: 0 0 12px 0;
    color: #555;
    line-height: 1.5;
    font-size: 14px;
}

.episode-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.episode-meta span {
    font-size: 12px;
    color: #7f8c8d;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.episode-meta .status {
    font-weight: 500;
}

.episode-meta .status.available {
    background: #d4edda;
    color: #155724;
}

.episode-meta .status.unavailable {
    background: #f8d7da;
    color: #721c24;
}

.episode-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.episode-actions .btn-edit,
.episode-actions .btn-delete {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.episode-actions .btn-edit {
    background: #667eea;
    color: white;
}

.episode-actions .btn-edit:hover {
    background: #5a67d8;
}

.episode-actions .btn-delete {
    background: #f56565;
    color: white;
}

.episode-actions .btn-delete:hover {
    background: #e53e3e;
}

/* Episodes List Container */
#episodesList {
    margin-top: 20px;
    padding: 0;
}

/* Responsive Episode Management */
@media (max-width: 768px) {
    .episode-item {
        flex-direction: column;
        gap: 15px;
    }
    
    .episode-info {
        margin-right: 0;
    }
    
    .episode-actions {
        justify-content: flex-start;
        width: 100%;
    }
    
    .episode-meta {
        gap: 10px;
    }
}

/* Homepage Management Styles */
.homepage-grid {
    display: grid;
    gap: 30px;
    margin-top: 20px;
}

.homepage-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid var(--border-color);
}

.homepage-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 600;
}

.featured-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.featured-slot {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.featured-slot:hover {
    border-color: var(--primary-color);
}

.slot-header {
    background: var(--bg-secondary);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
}

.slot-content {
    padding: 20px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-slot {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
}

.slot-drama {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.slot-drama img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.slot-drama-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-size: 1em;
}

.slot-drama-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.highlight-controls {
    display: grid;
    gap: 15px;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.highlight-item label {
    min-width: 180px;
    font-weight: 500;
    color: var(--text-primary);
}

.highlight-item select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9em;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8em;
    border-radius: 4px;
}

/* Positioning Controls for Hero Carousel */
.positioning-controls {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.positioning-controls label {
    display: inline-block;
    font-weight: 600;
    color: #495057;
    margin-right: 8px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.positioning-controls select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    color: #495057;
    font-size: 0.85em;
    margin-right: 15px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.positioning-controls select:hover {
    border-color: #80bdff;
}

.positioning-controls select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}