/* ==========================================================================
   1. Base & Body Styles
   ========================================================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f9; /* Light grey background for the whole page */
    color: #333; /* Default text color */
    margin: 0;
    padding-top: 60px; /* Leave space for the fixed top navigation bar */
}

h1, h2, h3 {
    margin-top: 0;
    font-weight: 600;
}

/* ==========================================================================
   2. Layout Components
   ========================================================================== */

.page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
}

/* Specific container for the login/signup pages */
.auth-container {
    background-color: #fff;
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    margin: 2rem auto;
}

.auth-container h2 {
    margin-bottom: 1.5rem;
}

.auth-link {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-link a {
    color: #007bff;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   3. Navigation Components
   ========================================================================== */

.top-nav {
    background-color: #004d40; /* Dark teal color */
    color: white;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.top-nav-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.top-nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username-display {
    font-size: 1rem;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.dropdown-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f1f1f1;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    overflow: hidden; /* Ensures content respects border-radius */
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #ddd;
}

.show {
    display: block; /* Class added by JavaScript to show the menu */
}


/* ==========================================================================
   4. UI Components (Cards, Buttons, Lists)
   ========================================================================== */

/* Card Component */
.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

/* List Component */
.list-item-link {
    text-decoration: none;
    color: inherit;
    display: block; /* Makes the whole area clickable */
}

.list-item {
    background-color: #fff;
    padding: 1rem 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Button Component */
a.btn,
button.btn {
    display: inline-block;
    box-sizing: border-box; 
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 5px;
    margin: 0;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn-primary { background-color: #04864a; border-color: #007bff; }
.btn-primary:hover { background-color: #0056b3; border-color: #0056b3; }

.btn-secondary { background-color: #6c757d; border-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; border-color: #5a6268; }

.btn-danger { background-color: #dc3545; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }

.btn-success { background-color: #28a745; border-color: #28a745; }
.btn-success:hover { background-color: #218838; border-color: #1e7e34; }


/* ==========================================================================
   5. Form Components
   ========================================================================== */

.form-layout {
    background: #ffffff;
    padding: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* This targets all common form inputs for consistent styling */
.form-control,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group select {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}


/* ==========================================================================
   6. Utility & Modifier Classes
   ========================================================================== */

/* For specific text elements */
.text-muted {
    color: #6c757d;
}

/* For financial balances */
.balance {
    font-weight: bold;
    font-size: 1.25rem;
}
.balance-positive {
    color: #28a745;
}
.balance-negative {
    color: #dc3545;
}

/* For Django form validation messages */
.invalid-feedback,
.helptext {
    font-size: 0.875em;
    margin-top: 0.25rem;
}
.invalid-feedback {
    color: #dc3545;
}
.helptext {
    color: #6c757d;
}

/* For server-side messages (from django.contrib.messages) */
.messages .alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
}
.messages .alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.messages .alert-danger, /* For errors */
.errorlist {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    list-style-type: none; /* For form error lists */
    padding: 1rem;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.picture-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.2s;
}
.picture-grid-item:hover img {
    transform: scale(1.05);
}
.picture-detail-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}
.filter-controls {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
}

/* Add to static/css/style.css */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.video-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    background-color: #000; /* BG for videos that are loading */
}
.video-detail-player {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background-color: #000;
}

.picture-grid-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* Makes the grid items perfectly square */
}

.picture-grid-item.online {
    cursor: pointer;
}

.picture-grid-item .download-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.picture-grid-item.online:hover .download-overlay {
    opacity: 1;
}

.picture-grid-item .download-icon {
    color: white;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.picture-grid-item .download-icon.loading {
    font-size: 1.5rem; /* Make the '...' smaller */
}