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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #fafafa;
}

/* Colors */
:root {
    --primary-color: #667eea;
    --primary-hover: #5568d3;
    --light-gray: #f8f9fa;
    --border-color: #e5e7eb;
    --text-gray: #6b7280;
    --text-dark: #1a1a1a;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Layout - App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: 60px;
    display: flex;
    flex-direction: column;
}

/* Sidebar Navigation */
.sidebar {
    width: 60px;
    background: white;
    color: var(--text-gray);
    transition: width 0.3s ease, box-shadow 0.3s ease;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
}

.sidebar:hover {
    width: 250px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar:hover .sidebar-header h3 {
    opacity: 1;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background: #f8fafc;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-menu .text {
    margin-left: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    font-weight: 500;
}

.sidebar:hover .sidebar-menu .text {
    opacity: 1;
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 60px;
    right: 0;
    height: 60px;
    background: white;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-name {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.page-title {
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 600;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-gray);
    display: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: var(--text-gray);
    font-size: 14px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    margin-top: 60px;
}

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

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(82, 37, 85, 0.1);
}

/* Form Validation Styles */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-group.has-error input:focus,
.form-group.has-error textarea:focus,
.form-group.has-error select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.form-group.has-success input,
.form-group.has-success textarea,
.form-group.has-success select {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.error-message {
    display: block;
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 0;
    font-weight: 500;
}

.success-message {
    display: block;
    color: #28a745;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 0;
    font-weight: 500;
}

/* Form field icons for validation states */
.form-group.has-error {
    position: relative;
}

.form-group.has-error::after {
    content: "⚠";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #dc3545;
    font-size: 16px;
    pointer-events: none;
}

.form-group.has-success::after {
    content: "✓";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
}

/* Adjust for checkbox form groups */
.form-check.has-error .form-check input[type="checkbox"] {
    border-color: #dc3545;
}

.form-check.has-error .error-message {
    margin-left: 0;
}

/* Authentication Top Header */
.auth-top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-top-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
}

.auth-brand {
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.auth-brand:hover {
    opacity: 0.8;
}

.auth-site-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* Authentication Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    padding-top: 70px; /* Space for header */
}

/* Form Checkbox Styling */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.form-check input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(82, 37, 85, 0.1);
}

.form-check input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-check input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(82, 37, 85, 0.2);
}

.form-check label {
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 0;
}

.form-check label a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-check label a:hover {
    text-decoration: underline;
}

.auth-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-form h2 {
    margin-bottom: 30px;
    text-align: center;
    color: var(--primary-color);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 30px;
    color: var(--primary-color);
}

.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: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.stat-card p {
    color: var(--text-gray);
    font-size: 14px;
}

.recent-section h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

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

.image-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-info {
    padding: 15px;
}

.image-info h4 {
    margin-bottom: 8px;
    color: var(--primary-color);
}

.image-info p {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 8px;
}

.image-info small {
    color: var(--text-gray);
    font-size: 12px;
}

/* Upload Form */
.upload-section h1 {
    margin-bottom: 30px;
    color: var(--primary-color);
}

.upload-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 600px;
}

/* Images List */
.images-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h1 {
    color: var(--primary-color);
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 200px;
}

.pagination-controls {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-controls a {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-gray);
    font-size: 12px;
}

.pagination-controls a.active,
.pagination-controls a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.table-container {
    overflow-x: auto;
}

.images-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.images-table th,
.images-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.images-table th {
    background: var(--light-gray);
    font-weight: 500;
    color: var(--primary-color);
}

.table-image {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

/* Image Detail */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.detail-header h1 {
    color: var(--primary-color);
}

.detail-layout {
    display: grid;
    grid-template-columns: 25% 75%;
    gap: 30px;
}

.original-image {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.original-image h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.main-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.image-info p {
    margin-bottom: 10px;
    font-size: 14px;
}

.variations-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.variations-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.variations-table {
    overflow-x: auto;
}

.variations-table table {
    width: 100%;
    border-collapse: collapse;
}

.variations-table th,
.variations-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.variations-table th {
    background: var(--light-gray);
    font-weight: 500;
}

.variation-thumbnail {
    width: 50px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.variation-thumbnail:hover {
    transform: scale(1.1);
}

.variation-row {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.variation-row:hover {
    background: var(--light-gray);
}

.videos-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lightbox-content img {
    max-width: calc(90vw - 40px);
    max-height: calc(90vh - 100px); /* Account for padding and info section */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.lightbox-info {
    margin-top: 15px;
    text-align: center;
    color: white;
    max-width: 100%;
}

.lightbox-info h4 {
    margin: 0 0 10px 0;
    color: white;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-gray);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid white;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    pointer-events: none;
}

.flash-messages .alert {
    pointer-events: auto;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease-in;
}

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

.alert-content {
    display: flex;
    align-items: center;
}

.alert-icon {
    margin-right: 10px;
    font-size: 16px;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-menu-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu-btn:hover {
    background: var(--light-gray);
}

.user-role {
    font-size: 12px;
    opacity: 0.7;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-gray);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.user-dropdown-menu a:hover {
    background: var(--light-gray);
    color: var(--primary-color);
}

.user-dropdown-menu .icon {
    margin-right: 10px;
    width: 16px;
}

.dropdown-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

/* Sidebar active state */
.sidebar-menu a.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(102, 126, 234, 0.05) 100%);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu .separator {
    height: 1px;
    background: var(--border-color);
    margin: 10px 15px;
}

/* Collapsible Menu Styles */
.sidebar-menu .menu-section {
    margin-bottom: 0;
}

.sidebar-menu .menu-toggle {
    position: relative;
    cursor: pointer;
}

.sidebar-menu .menu-toggle .arrow {
    position: absolute;
    right: 20px;
    font-size: 12px;
    transition: transform 0.3s ease;
    opacity: 0;
    color: var(--text-gray);
}

.sidebar:hover .menu-toggle .arrow {
    opacity: 1;
}

.sidebar-menu .submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8fafc;
    margin: 0;
    padding: 0;
    border-left: 2px solid var(--border-color);
}

.sidebar-menu .submenu.open {
    max-height: 300px;
}

.sidebar-menu .submenu li {
    margin-bottom: 0;
}

.sidebar-menu .submenu a {
    padding: 10px 20px 10px 45px;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.sidebar-menu .submenu a:hover {
    background: white;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-menu .submenu a.active {
    background: white;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu .submenu .icon {
    font-size: 16px;
    width: 20px;
}

.sidebar-menu .submenu .text {
    margin-left: 12px;
}

/* Dashboard specific styles */
.welcome-section {
    margin-bottom: 30px;
}

.welcome-subtitle {
    color: var(--text-gray);
    margin-top: 5px;
}

.usage-overview {
    margin: 30px 0;
}

.usage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.usage-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary-color);
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.usage-count, .usage-success, .usage-time {
    font-size: 12px;
    color: var(--text-gray);
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-processing { background: #d1ecf1; color: #0c5460; }
.status-completed { background: #d4edda; color: #155724; }
.status-failed { background: #f8d7da; color: #721c24; }

.image-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
}

.quick-actions {
    margin-top: 40px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.action-icon {
    font-size: 24px;
    margin-right: 15px;
}

.action-content h4 {
    margin: 0 0 5px 0;
    color: var(--primary-color);
}

.action-content p {
    margin: 0;
    color: var(--text-gray);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        width: 0;
        overflow: hidden;
    }

    .sidebar.mobile-open {
        width: 250px;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .top-nav {
        left: 0;
    }

    .page-title {
        display: none;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .search-form {
        justify-content: center;
    }

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

    .images-table {
        font-size: 12px;
    }

    .images-table th,
    .images-table td {
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }

    .auth-form {
        padding: 25px;
        margin: 20px;
    }

    .upload-form {
        padding: 20px;
    }

    .images-section {
        padding: 20px;
    }
}

/* ============================================================================
   DASHBOARD DARK THEME (MUBI-style)
   ============================================================================ */

.dashboard-dark {
    background: #0a0a0a;
    padding: 0 !important;
}

.dashboard-dark .dashboard {
    max-width: 100%;
}

/* Welcome section */
.dashboard-dark .welcome-section {
    padding: 24px 20px 0;
    margin-bottom: 16px;
}

.dashboard-dark .welcome-section h1 {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dashboard-dark .welcome-subtitle {
    color: #999;
    font-size: 13px;
}

/* Stats grid - compact dark cards */
.dashboard-dark .stats-grid {
    padding: 0 20px;
    gap: 10px;
    margin-bottom: 24px;
    grid-template-columns: repeat(3, 1fr);
}

.dashboard-dark .stat-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 14px 12px;
}

.dashboard-dark .stat-card h3 {
    color: #ffffff;
    font-size: 22px;
}

.dashboard-dark .stat-card p {
    color: #999;
    font-size: 11px;
}

.dashboard-dark .stat-card small {
    color: #666;
    font-size: 10px;
}

.dashboard-dark .stat-icon {
    font-size: 16px;
    margin-bottom: 4px;
}

/* API Usage */
.dashboard-dark .usage-overview {
    padding: 0 20px;
    margin: 0 0 24px;
}

.dashboard-dark .usage-overview h2 {
    color: #ffffff;
    font-size: 16px;
}

.dashboard-dark .usage-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-left: 4px solid var(--primary-color);
}

.dashboard-dark .usage-card h4 {
    color: #ccc;
}

.dashboard-dark .usage-count,
.dashboard-dark .usage-success,
.dashboard-dark .usage-time {
    color: #888;
}

/* Hero featured card */
.hero-card {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 480px;
    overflow: hidden;
    text-decoration: none;
}

.hero-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 20px 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
}

.hero-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.2;
}

.hero-description {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Thumbnail section header */
.thumb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 12px;
}

.thumb-section-label {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.thumb-section-link {
    color: #999;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.thumb-section-link:hover {
    color: #ffffff;
}

/* Thumbnail strip - horizontal scroll */
.thumb-strip {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 0 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.thumb-strip::-webkit-scrollbar {
    display: none;
}

.thumb-card {
    position: relative;
    flex: 0 0 calc(50% - 1px);
    aspect-ratio: 2 / 3;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.thumb-title {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumb-meta {
    color: rgba(255,255,255,0.6);
    font-size: 10px;
}

/* Quick actions - dark theme */
.dashboard-dark .quick-actions {
    padding: 20px;
    margin-top: 24px;
}

.dashboard-dark .quick-actions h2 {
    color: #ffffff;
    font-size: 16px;
}

.dashboard-dark .action-btn {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #ffffff;
}

.dashboard-dark .action-btn:hover {
    border-color: var(--primary-color);
    background: #222;
}

.dashboard-dark .action-content h4 {
    color: #ffffff;
}

.dashboard-dark .action-content p {
    color: #888;
}

/* Empty state dark */
.dashboard-dark .empty-state {
    color: #999;
}

.dashboard-dark .empty-state h3 {
    color: #ffffff;
}

/* Recent section header override */
.dashboard-dark .recent-section .section-header {
    display: none;
}

/* Responsive: desktop adjustments */
@media (min-width: 769px) {
    .dashboard-dark {
        padding: 0 !important;
    }

    .hero-card {
        aspect-ratio: 16 / 9;
        max-height: 500px;
    }

    .thumb-card {
        flex: 0 0 calc(25% - 2px);
    }

    .dashboard-dark .stats-grid {
        padding: 0 30px;
    }

    .dashboard-dark .welcome-section {
        padding: 30px 30px 0;
    }

    .dashboard-dark .usage-overview {
        padding: 0 30px;
    }

    .dashboard-dark .quick-actions {
        padding: 30px;
    }

    .thumb-section-header {
        padding: 24px 30px 12px;
    }
}

/* ============================================================================
   B-ROLL STYLES
   ============================================================================ */

.broll-page {
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.page-subtitle {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

/* B-Roll Grid */
.broll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.broll-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.broll-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #522555;
}

.broll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.broll-card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex: 1;
    margin-right: 10px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.status-draft {
    background-color: #f0f0f0;
    color: #666;
}

.status-badge.status-prompt_generated {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-badge.status-processing {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-badge.status-completed {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status-badge.status-failed {
    background-color: #ffebee;
    color: #d32f2f;
}

.broll-card-body {
    color: #666;
}

.broll-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.meta-icon {
    font-size: 16px;
}

.broll-theme {
    color: #333;
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

.broll-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.broll-footer small {
    color: #999;
    font-size: 12px;
}

/* B-Roll Detail Modal */
.modal-large {
    width: 90%;
    max-width: 900px;
}

.broll-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

.detail-item {
    font-size: 14px;
}

.detail-item strong {
    display: block;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* JSON Viewer */
.json-viewer-section {
    margin-top: 25px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.json-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.json-viewer-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.json-viewer-actions {
    display: flex;
    gap: 10px;
}

.json-viewer {
    padding: 0;
    background: #1e1e1e;
    color: #d4d4d4;
    max-height: 500px;
    overflow: auto;
}

.json-viewer pre {
    margin: 0;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.json-viewer .no-data {
    padding: 40px;
    text-align: center;
    color: #999;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #9cdcfe;
}

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

.json-boolean {
    color: #569cd6;
}

.json-null {
    color: #569cd6;
}

/* Create Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.reference-object-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.reference-object-item input {
    flex: 1;
}

.required {
    color: red;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* Responsive adjustments for B-Roll */
@media (max-width: 768px) {
    .broll-grid {
        grid-template-columns: 1fr;
    }

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

    .modal-large {
        width: 95%;
        max-width: none;
    }

    .broll-detail-grid {
        grid-template-columns: 1fr;
    }

    .json-viewer-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .json-viewer-actions {
        width: 100%;
        justify-content: flex-end;
    }
}