/* Basic Reset & Body Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 25px; /* Space for fixed header */
    padding-bottom: 80px; /* Space for fixed footer */
}

/* Header */
.header {
    background-color: #1877f2;
    color: #fff;
    padding: 5px 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header .logo {
    font-weight: bold;
    font-size: 24px;
    color: #fff;
}

/* Header Navigation */
.header-nav {
    display: flex;
    gap: 25px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap; /* Prevent wrapping of nav items */
}

.header-nav a {
    color: #fff;
    font-size: 16px; /* Slightly smaller for better fit */
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 5px;
    display: flex; /* Allow icon and text to align */
    align-items: center;
    gap: 5px; /* Space between icon and text */
}

.header-nav a i {
    font-size: 20px; /* Icon size */
}

.header-nav a:hover {
    color: #d4e6ff;
    background-color: rgba(255,255,255,0.1);
}

.hamburger-menu {
    font-size: 24px;
    cursor: pointer;
    display: none; /* Hidden by default on desktop */
    color: #fff;
}

/* Top Ad Banner */
.ad-banner-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    background-color: #242526;
    padding: 10px 0;
    gap: 5px;
    justify-items: center;
    align-items: center;
    margin-top: 60px; /* Below the fixed header */
}

.ad-banner-top .ad-slot {
    background-color: #3a3b3c;
    color: #e4e6eb;
    padding: 10px 0;
    text-align: center;
    width: 90%;
    min-width: 80px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #4e4f50;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-grow: 1;
    padding: 20px;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: flex-start; /* Align content to the top */
}

/* General Container for pages (e.g., dashboard, profile, upload, manage) */
.container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 900px; /* Default max-width for containers */
    margin: 40px auto; /* Center with auto margins */
    text-align: center;
    width: 100%; /* Ensure it takes full width within flex container */
}
.container h1, .container h2 {
    margin-bottom: 25px;
    color: #333;
    text-align: center; /* Ensures headings are centered */
}

/* Specific container adjustments for dashboard */
.dashboard-container {
    max-width: 800px; /* Slightly narrower for dashboard content */
}

/* Specific container adjustments for profile */
.profile-container {
    max-width: 500px; /* Narrower for profile form */
}
.profile-container form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.profile-container label {
    text-align: left;
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}
.profile-container input[type="text"],
.profile-container input[type="email"] {
    padding: 12px;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}
.profile-container button {
    background-color: #1877f2;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: auto;
    align-self: center;
    margin-top: 10px;
}
.profile-container button:hover {
    background-color: #166fe5;
}


/* Left and Right Grids for Videos (on index.php) */
.left-grid, .right-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    flex: 1 1 300px; /* Allow grids to grow/shrink, with a base of 300px */
    max-width: 400px; /* Max width for each side grid */
}

.grid-video-item {
    background-color: #000;
    border: 1px solid #dddfe2;
    height: 120px; /* Fixed height for video thumbnails */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s ease;
}

.grid-video-item:hover {
    transform: scale(1.02);
}

.grid-video-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.grid-video-item:hover img {
    opacity: 1;
}

.video-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    gap: 5px;
    padding: 5px;
    box-sizing: border-box;
}

.video-item-overlay span {
    word-break: break-word;
    line-height: 1.2;
}

.video-item-overlay .fa-play {
    font-size: 28px;
    color: #ff0000;
    border: 2px solid #fff;
    border-radius: 50%;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Fixed Grid Items for static images (used in login.php) */
.grid-item {
    background-color: #fff;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1/1; /* Ensures perfect 1:1 ratio for static images */
}

.grid-item-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.grid-item:hover img {
    transform: scale(1.05);
}

.grid-item.special-item {
    background-color: #e7f3ff;
    color: #1877f2;
    font-weight: bold;
    padding: 5px;
    text-align: center;
    line-height: 1.2;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Center Column (flexible layout) */
.center-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 500px;
    flex: 2 1 400px; /* Allow center column to be larger */
}

/* Ad Banners within content */
.ad-banner {
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    border-radius: 5px;
    color: #fff;
}

.ad-banner.blue-bg {
    background-color: #007bff;
}

.ad-banner.red-bg {
    background-color: #e41e3f;
}

/* Login/Registration Card (used in login.php) */
.login-registration-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

.login-registration-card h3 {
    margin-bottom: 20px;
    color: #333;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tab-button {
    background-color: #f0f2f5;
    border: 1px solid #dddfe2;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    flex-grow: 1;
    text-align: center;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    transition: background-color 0.3s ease;
}

.tab-button.active {
    background-color: #1877f2;
    color: #fff;
    border-color: #1877f2;
}

.login-registration-card form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.login-registration-card input[type="email"],
.login-registration-card input[type="text"],
.login-registration-card input[type="password"] {
    padding: 12px;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    font-size: 16px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.sign-in-button {
    background-color: #1877f2;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none; /* Ensure no underline on anchor tags */
    display: inline-block; /* Allow padding and margin on anchor tags */
}

.sign-in-button:hover {
    background-color: #166fe5;
}

/* Video Placeholder (used in index.php and login.php) */
.video-placeholder {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    position: relative;
    padding-top: 0; /* Adjusted for better spacing with embed */
}

.video-placeholder p {
    margin-bottom: 15px;
    font-weight: bold;
    color: #555;
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio for responsive video */
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 5px;
}

.video-embed iframe,
.video-embed video { /* Added video tag for view_video.php */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.inner-video-overlay, .video-overlay { /* Combined from both original files */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 18px;
    z-index: 1;
}

.inner-video-overlay .fa-play, .video-overlay .fa-play {
    font-size: 24px;
}

/* Footer */
.footer {
    background-color: #242526;
    padding: 1px 2px;
    display: flex;
    justify-content: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1200px; /* Limit width for larger screens */
}

.footer-nav a {
    color: #ffffff;
    font-size: 22px; /* Adjusted icon size for footer */
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px; /* Padding to make touch target larger */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* Fixed width for consistent circle shape */
    height: 40px; /* Fixed height for consistent circle shape */
    border-radius: 50%;
}

.footer-nav a:hover {
    background-color: rgba(255,255,255,0.15);
    transform: translateY(-3px);
}

/* Dashboard specific styles */
.dashboard-container h2 {
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
}
.stats-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 150px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid #eee;
}

.stat-card h3 {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 28px;
    font-weight: bold;
    color: #1877f2;
}

.user-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.user-video-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.user-video-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}
.user-video-item h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}
.user-video-item p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}
.user-video-item .status-approved {
    color: green;
    font-weight: bold;
}
.user-video-item .status-pending {
    color: orange;
    font-weight: bold;
}
.user-video-item .user-video-button {
    margin-top: 15px;
    padding: 10px 15px;
    font-size: 16px;
    text-decoration: none;
    display: block;
    text-align: center;
}

.dashboard-actions {
    margin-top: 30px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.dashboard-actions .sign-in-button {
    padding: 12px 25px;
    margin: 5px;
}


/* Manage Videos specific styles */
.manage-videos-container { /* New class for manage videos specific container */
    max-width: 1000px; /* Wider for tables */
}
.video-management-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.video-management-table th, .video-management-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}
.video-management-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
.video-management-table img {
    max-width: 80px;
    height: auto;
    border-radius: 4px;
}
.video-actions { /* Class applied to <td> for action buttons */
    white-space: nowrap; /* Prevent buttons from wrapping */
}
.video-actions form {
    display:inline-block; /* Keep forms inline */
    margin-right: 5px; /* Space between buttons/forms */
}
.video-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}
.video-actions .approve-btn {
    background-color: #28a745;
    color: white;
}
.video-actions .approve-btn:hover {
    background-color: #218838;
}
.video-actions .deny-btn {
    background-color: #dc3545;
    color: white;
}
.video-actions .deny-btn:hover {
    background-color: #c82333;
}

/* Upload Video specific styles */
.upload-form-container { /* Reusing .container, then specific overrides */
    max-width: 600px;
}
.upload-form-container form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.upload-form-container input[type="text"],
.upload-form-container textarea,
.upload-form-container input[type="file"] {
    padding: 12px;
    border: 1px solid #dddfe2;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}
.upload-form-container textarea {
    resize: vertical;
    min-height: 80px;
}
.upload-form-container label {
    text-align: left;
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}
.upload-form-container button {
    background-color: #1877f2;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: auto;
    align-self: center;
    margin-top: 10px;
}
.upload-form-container button:hover {
    background-color: #166fe5;
}

/* View Video specific styles */
.video-detail-container { /* Reusing .container, then specific overrides */
    max-width: 800px;
    margin: 40px auto;
}
.video-detail-container h1 {
    margin-bottom: 15px;
    color: #333;
}
.uploader-info {
    color: #666;
    margin-bottom: 10px;
}
.video-player-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 5px;
    margin-bottom: 20px;
}
.video-player-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.video-meta .views {
    font-size: 16px;
    color: #555;
}
.social-share {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.share-btn {
    background-color: #1877f2;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}
.share-btn.facebook { background-color: #3b5998; }
.share-btn.twitter { background-color: #00acee; }
.share-btn.copy { background-color: #6c757d; }

.share-btn:hover {
    opacity: 0.9;
}
.video-description {
    text-align: left;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.video-description h2 {
    font-size: 20px;
    margin-bottom: 10px;
}
.video-description p {
    color: #444;
    line-height: 1.6;
}

/* Messages */
.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
    max-width: 90%;
}
.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }

    .left-grid, .right-grid, .center-column {
        width: 100%;
        max-width: 600px;
        flex-basis: auto;
    }

    .left-grid, .right-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    .header-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background-color: #1877f2;
        padding: 10px 0;
        align-items: center;
        gap: 15px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    .header-nav.active {
        display: flex;
    }

    .header-nav a {
        width: auto;
        padding: 8px 15px;
        justify-content: flex-start;
    }

    .hamburger-menu {
        display: block;
    }

    .ad-banner-top {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 2px;
    }

    .main-content {
        padding: 10px;
        gap: 10px;
    }

    .left-grid, .right-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }

    .footer-nav {
        gap: 20px;
    }
    .footer-nav a {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-card p {
        font-size: 20px;
    }
    .user-videos-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 15px;
        margin: 20px auto;
    }
    .dashboard-actions .sign-in-button {
        padding: 10px 20px; /* Adjust padding for smaller screens */
    }
    .video-management-table th, .video-management-table td {
        font-size: 12px;
        padding: 8px;
    }
    .video-actions button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .left-grid, .right-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    }
    
    .grid-video-item {
        height: 100px;
    }
    
    .video-item-overlay {
        font-size: 12px;
    }
    
    .video-item-overlay .fa-play {
        font-size: 22px;
        padding: 3px;
    }
    
    .footer-nav {
        gap: 15px;
    }
    
    .footer-nav a {
        font-size: 18px;
        width: 32px;
        height: 32px;
    }
    .stats-summary {
        flex-direction: column;
    }
    .stat-card {
        min-width: unset;
    }
    .video-management-table th, .video-management-table td {
        font-size: 10px;
        padding: 5px;
    }
    .video-management-table img {
        max-width: 60px;
    }
    .video-actions button {
        padding: 5px 8px;
        font-size: 10px;
    }
}
