@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
    line-height: 1.6;
}

a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #764ba2;
}

button {
    font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    font-family: inherit;
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #27ae60;
}

.invalid {
    outline: 1px solid #e74c3c;
}

.validation-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Error UI */
#blazor-error-ui {
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #856404;
}

#blazor-error-ui .dismiss {
    display: inline-block;
    float: right;
    opacity: 0.5;
    cursor: pointer;
}

#blazor-error-ui .dismiss:hover {
    opacity: 0.75;
}

/* Loading state */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Gallery Styles */
.gallery-container {
    width: 100% !important;
    min-height: 90vh !important;
    padding: 40px 20px;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-clip: border-box !important;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.gallery-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin: 0;
}

.btn-upload {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    animation: fadeIn 0.5s ease-in;
}

.video-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a1a;
    overflow: hidden;
}

.card-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.description {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #95a5a6;
    margin-bottom: 15px;
}

.card-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.btn-small {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-small.edit {
    background: #3498db;
    color: white;
}

.btn-small.edit:hover {
    background: #2980b9;
}

.btn-small.delete {
    background: #e74c3c;
    color: white;
}

.btn-small.delete:hover {
    background: #c0392b;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #7f8c8d;
}

.spinner {
    border: 4px solid #ecf0f1;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Upload Styles */
.upload-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 40px;
    animation: slideDown 0.5s ease-out;
}

.upload-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.upload-card h2 {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

.file-input-wrapper {
    position: relative;
}

::deep input[type="file"] {
    padding: 12px;
    border: 2px dashed #667eea;
    border-radius: 6px;
    background: #f8f9ff;
    cursor: pointer;
    width: 100%;
}

.file-info {
    color: #27ae60;
    font-size: 0.9rem;
    margin-top: 8px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Editor Styles */
.editor-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

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

.editor-header h1 {
    margin: 0;
    color: #2c3e50;
}

.btn-back {
    padding: 10px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-back:hover {
    background: #7f8c8d;
}

.editor-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.preview-panel h3,
.edit-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.video-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.form-group input:read-only {
    background: #f8f9fa;
    cursor: not-allowed;
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn-save {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-save:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Responsive */
@media (max-width: 768px) {
    html, body {
        font-size: 14px;
    }

    .gallery-header {
        flex-direction: column;
        gap: 20px;
    }

    .gallery-header h1 {
        font-size: 1.8rem;
    }

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

    .editor-content {
        grid-template-columns: 1fr;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   PROFESSIONAL POLISH (May 2026)
   ────────────────────────────────────────────────────────────────────────── */

/* Make MediaCarousel fill gallery card image area */
.video-card .card-image .media-carousel,
.video-card .card-image .media-main {
    width: 100%;
    height: 100%;
}
.video-card .card-image .media-main video,
.video-card .card-image .media-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}
.video-card .card-image .media-thumbs {
    display: none; /* keep cards clean; full thumbs visible on detail page */
}

/* Multi-item badge on cards */
.card-badge {
    position: absolute;
    top: 12px; left: 12px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    z-index: 3;
    backdrop-filter: blur(4px);
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* Clickable card title */
.card-title-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.card-title-link:hover h3 {
    color: #667eea;
}
.card-title-link h3 {
    transition: color 0.2s ease;
}

/* Card "View detail" button */
.btn-small.view {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 8px;
}
.btn-small.view:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Meta chips */
.meta {
    flex-wrap: wrap;
}
.meta .location,
.meta .gps,
.meta .date {
    background: rgba(248, 249, 251, 0.85);
    padding: 4px 10px;
    border-radius: 999px;
    color: #4a5568;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.18s;
}
.meta .gps {
    color: #667eea;
}
.meta .gps:hover {
    background: rgba(102, 126, 234, 0.12);
}

/* Nav active state polish */
.nav-menu a {
    position: relative;
    padding: 6px 2px;
}
.nav-menu a::after {
    content: '';
    position: absolute;
    left: 50%; right: 50%; bottom: -2px;
    height: 2px;
    background: white;
    transition: left 0.2s, right 0.2s;
}
.nav-menu a:hover::after {
    left: 0; right: 0;
}

/* Form group hint text */
.form-group .hint {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-top: 4px;
}

