/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f9f9f9;
  color: #333;
  line-height: 1.6;
}

/* Container Layout */
.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  background: #1976d2;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  position: relative;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.2s;
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.1);
}

header h1 {
  margin: 0;
  font-size: 28px;
}

.admin-link a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  transition: all 0.2s;
}

.admin-link a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* Main Layout - Sidebar + Content */
.main-layout {
  display: flex;
  flex: 1;
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid #ddd;
  padding: 20px 0;
  position: fixed;
  top: 70px;
  left: 0;
  height: calc(100vh - 70px);
  overflow-y: auto;
  z-index: 50;
}

.sidebar h3 {
  margin: 0 0 15px 20px;
  color: #1976d2;
  font-size: 18px;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  margin: 0;
}

.category-link {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.category-link:hover {
  background: #f5f5f5;
  color: #1976d2;
  border-left-color: #1976d2;
}

.category-link.active {
  background: #e3f2fd;
  color: #1976d2;
  border-left-color: #1976d2;
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 20px;
}

/* Video Grid */
#video-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Video Card */
.video-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Thumbnail Container */
.thumbnail-container {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #000;
}

.video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.video-card:hover .video-thumbnail {
  transform: scale(1.05);
}

/* Play Overlay */
.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.play-button {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #1976d2;
  transform: scale(0.8);
  transition: transform 0.2s;
}

.video-card:hover .play-button {
  transform: scale(1);
}

/* Video Info */
.video-info {
  padding: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.video-info:hover {
  background-color: #f5f5f5;
}

.video-info h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #1976d2;
  font-weight: 600;
  transition: color 0.2s ease;
}

.video-info:hover h3 {
  color: #1565c0;
}

.video-description {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-tag {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Watch Page Styles */
.watch-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.watch-header {
  margin-bottom: 20px;
}

.watch-header h1 a {
  color: #1976d2;
  text-decoration: none;
  font-size: 24px;
}

.watch-header h1 a:hover {
  text-decoration: underline;
}

.video-player-section {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.video-player {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.video-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-details {
  padding: 20px;
}

.video-details h2 {
  margin: 0 0 10px 0;
  color: #1976d2;
  font-size: 24px;
}

.video-meta {
  margin-bottom: 15px;
}

.tag-badge {
  background: #1976d2;
  color: white;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
}

/* Related Videos */
.related-videos-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

.related-videos-section h3 {
  margin: 0 0 20px 0;
  color: #1976d2;
  font-size: 20px;
}

.related-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
}

.related-video-card {
  display: flex;
  background: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.related-video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.related-thumbnail {
  position: relative;
  width: 120px;
  height: 90px;
  overflow: hidden;
  background: #000;
}

.related-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay-small {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.related-video-card:hover .play-overlay-small {
  opacity: 1;
}

.play-button-small {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #1976d2;
}

.related-info {
  padding: 10px;
  flex: 1;
}

.related-info h4 {
  margin: 0 0 5px 0;
  font-size: 14px;
  color: #1976d2;
  font-weight: 600;
}

.related-info p {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #666;
  line-height: 1.3;
}

.tag-small {
  font-size: 10px;
  background: #e3f2fd;
  color: #1976d2;
  padding: 2px 6px;
  border-radius: 8px;
}

/* Form Styles (Admin Pages) */
#auth, #form-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 25px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

input, textarea, select, button {
  width: 100%;
  margin: 10px 0;
  padding: 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

textarea {
  resize: vertical;
  height: 80px;
}

button[type="submit"], #auth button {
  background: #1976d2;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

button[type="submit"]:hover, #auth button:hover {
  background: #125aa0;
}

/* Links */
a {
  color: #1976d2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  #video-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
  }
  
  .related-video-card {
    flex-direction: column;
  }
  
  .related-thumbnail {
    width: 100%;
    height: 150px;
  }
  
  .watch-container {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 10px 15px;
  }
  
  header h1 {
    font-size: 20px;
  }
  
  .main-content {
    padding: 15px;
  }
  
  #video-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .related-videos-grid {
    grid-template-columns: 1fr;
  }
}

/* Video Submission Form Styles */
.submit-video-container {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
}

.submit-video-btn {
  background: linear-gradient(45deg, #1976d2, #2196f3);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.submit-video-btn:hover {
  background: linear-gradient(45deg, #1565c0, #1976d2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

.submit-video-btn .btn-icon {
  font-size: 18px;
}

/* Submit Page Styles */
.submission-page-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.submission-form-wrapper {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
}

.submission-form-wrapper h2 {
  margin: 0 0 10px 0;
  color: #1976d2;
  font-size: 24px;
  text-align: center;
}

.submission-form-wrapper p {
  margin: 0 0 25px 0;
  color: #666;
  text-align: center;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #333;
  font-weight: 500;
  font-size: 14px;
}

.submission-form input,
.submission-form textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.submission-form input:focus,
.submission-form textarea:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.submission-form textarea {
  min-height: 100px;
  resize: vertical;
}

.submission-form small {
  display: block;
  margin-top: 5px;
  color: #666;
  font-size: 12px;
}

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  justify-content: space-between;
}

.btn-primary {
  background: #1976d2;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  flex: 1;
}

.btn-primary:hover {
  background: #1565c0;
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}

.btn-secondary:hover {
  background: #e8e8e8;
  color: #333;
}

.submission-status {
  margin-top: 20px;
  text-align: center;
}

.status-success {
  color: #4caf50;
  background: #e8f5e9;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #c8e6c9;
}

.status-error {
  color: #f44336;
  background: #ffebee;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #ffcdd2;
}

.submission-form-container {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.submission-form-container h3 {
  margin: 0 0 15px 0;
  color: #1976d2;
  font-size: 18px;
}

.submission-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.submission-form button {
  background: #1976d2;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.submission-form button:hover {
  background: #1565c0;
}

/* Admin Submissions Section */
#submissions-container h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px 0;
  color: #333;
}

#submission-count {
  display: inline-block;
  min-width: 20px;
  text-align: center;
}

/* Responsive Design for Submission Form */
@media (max-width: 768px) {
  .submission-page-container {
    padding: 15px;
  }
  
  .submission-form-wrapper {
    padding: 20px;
    margin: 0 -5px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .btn-primary,
  .btn-secondary {
    flex: none;
  }
  
  .submit-video-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
  
  .submission-form-container {
    margin: 0 -15px 20px -15px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}
