/* ========================================
   Nick Rudd Memorial - Modern Design
   ======================================== */

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #bb8f00;
    --accent-color-dark: #947200;
    --text-color: #2d3436;
    --light-text: #636e72;
    --border-color: #dfe6e9;
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Header */
.memorial-header {
    background-color: var(--primary-color);
    background-image: 
        linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.7) 100%), 
        url(/uploads/header/header-background.jpg);
    background-size: cover;
    background-position: left;
    background-repeat: no-repeat;
    background-attachment: scroll;
    color: white;
    position: relative;
    overflow: hidden;
    transition: background-image 0.3s ease-in;
}

.memorial-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(233, 69, 96, 0.15) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

.memorial-header .container {
    position: relative;
    z-index: 1;
}

.memorial-header h1 {
    color: white;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.memorial-dates {
    opacity: 0.95;
    font-style: italic;
}

.memorial-tagline {
    opacity: 0.9;
}

.header-image-container {
    max-width: 400px;
    margin: 0 auto;
}

.header-image {
    max-width: 100%;
    height: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Navigation */
.navbar {
    padding: 0.75rem 0;
    background: var(--card-bg) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-btn {
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border: none;
    background: none;
    color: var(--text-color);
}

.nav-btn:hover {
    color: var(--accent-color);
    background: rgba(233, 69, 96, 0.08);
    border-radius: 0.5rem;
    transform: translateY(-1px);
}

.nav-btn.active {
    color: var(--accent-color);
    font-weight: 600;
    position: relative;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 0.5rem;
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: var(--accent-color);
    border-radius: 3px 3px 0 0;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

/* list-view removed - grid-only layout */

.gallery-item {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.75rem rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 0.75rem 2rem rgba(0,0,0,0.12);
}

.gallery-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    min-height: 250px;
}

.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.image-loader .spinner-border {
    width: 3rem;
    height: 3rem;
}

.gallery-image {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    /*box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.2);*/
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.gallery-image.loaded {
    opacity: 1;
}

.gallery-info {
    padding: 1.5rem;
}

.gallery-caption {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.gallery-meta {
    font-size: 0.875rem;
    color: var(--light-text);
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 1rem;
}

/* list-view CSS removed - only grid styling remains */

/* Empty Gallery */
.empty-gallery {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--light-text);
}

/* Pagination */
.pagination {
    margin: 2rem 0;
}

.pagination .page-link {
    color: var(--accent-color);
    border-color: var(--border-color);
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-weight: 600;
}

.pagination .page-item.disabled .page-link {
    color: var(--light-text);
    pointer-events: none;
    background-color: transparent;
    border-color: var(--border-color);
}

/* Items per page selector */
#itemsPerPage {
    border-color: var(--border-color);
    color: var(--text-color);
    cursor: pointer;
}

#itemsPerPage:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(187, 143, 0, 0.15);
}

/* File Upload */
.file-upload-area {
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.file-upload-area:hover {
    border-color: var(--primary-color) !important;
    background: rgba(44, 95, 111, 0.05);
}

.file-upload-area.drag-over {
    border-color: var(--accent-color) !important;
    background: rgba(212, 165, 116, 0.1);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.file-preview {
    width: 60px;
    height: 60px;
    border-radius: 0.375rem;
    object-fit: cover;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.875rem;
    color: var(--light-text);
}

.caption-input {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.remove-file {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.remove-file:hover {
    transform: scale(1.2);
}

/* Admin Section */
.admin-item {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.1);
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-item-image {
    width: 300px;
    height: 250px;
    object-fit: contain;
    background: #0f1116;
    padding: 0.5rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.admin-item-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.admin-item-meta {
    color: var(--light-text);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.admin-item-caption {
    flex: 1;
    margin: 1rem 0;
}

.admin-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.admin-image-wrapper {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.admin-image-loader {
    z-index: 10;
}

.admin-card-image {
    transition: opacity 0.3s ease;
}

/* Modal */
.modal-dialog {
    max-height: 100vh;
    margin: 1.75rem auto;
    display: flex;
    align-items: center;
}

.modal-content {
    max-height: calc(100vh - 3.5rem);
    display: flex;
    flex-direction: column;
}

.modal-body {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.modal-content-img {
    max-height: 70vh;
    object-fit: contain;
}

.modal-image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-loader .spinner-border {
    width: 3rem;
    height: 3rem;
}

#modalImage {
    max-height: calc(100vh - 16rem);
    min-height: 200px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 1;
    transition: opacity 0.3s ease;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
}

.modal-nav-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.modal-nav-prev {
    left: 20px;
}

.modal-nav-next {
    right: 20px;
}

#modalCounter {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* Footer */
.memorial-footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.memorial-footer p {
    margin-bottom: 0.5rem;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.message.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.message.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* Responsive */
/* Responsive Design - Mobile Optimizations */
@media (max-width: 768px) {
    /* Gallery - 2 columns on larger phones (576px+) */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem !important;
    }
    
    /* Ensure admin items stack on narrow screens and gallery images fit */
    .admin-item {
        flex-direction: column;
    }

    .admin-item-image {
        width: 100%;
        height: auto;
    }

    .gallery-grid .gallery-image {
        max-height: 420px;
    }
    
    /* Header */
    .memorial-header {
        padding: 2rem 0 !important;
    }
    
    .memorial-header h1 {
        font-size: 2rem !important;
    }
    
    .memorial-dates {
        font-size: 1rem !important;
    }
    
    .memorial-tagline {
        font-size: 1rem !important;
    }
    
    .header-image-container {
        max-width: 280px;
    }
    
    /* Navigation */
    .navbar {
        padding: 0.5rem 0;
    }
    
    .nav-btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }
    
    .nav-btn i {
        font-size: 1rem;
    }
    
    /* Buttons */
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Upload form */
    .file-upload-area {
        padding: 2rem 1rem !important;
    }
    
    .file-upload-area i {
        font-size: 2.5rem !important;
    }
    
    /* Cards */
    .card-body {
        padding: 1.5rem !important;
    }
    
    /* Admin panel */
    .filter-btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .admin-btn {
        font-size: 0.875rem;
        padding: 0.4rem 0.75rem;
    }
    
    /* Pagination */
    .pagination .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.875rem;
    }
    
    /* Items per page - stack on small screens */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
    
    #itemsPerPage {
        flex: 1;
        max-width: 150px;
    }
    
    /* Typography */
    .display-3 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    h2.h3 {
        font-size: 1.5rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 575px) {
    /* Gallery - 1 column on small phones */
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    /* Header */
    .memorial-header h1 {
        font-size: 1.75rem !important;
    }
    
    .memorial-dates {
        font-size: 0.9rem !important;
    }
    
    .memorial-tagline {
        font-size: 0.95rem !important;
    }
    
    .header-image-container {
        max-width: 240px;
    }
    
    /* Navigation - Stack vertically on very small screens */
    .navbar-nav {
        gap: 0.25rem;
    }
    
    .nav-btn {
        width: 100%;
        text-align: left;
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
    }
    
    /* Buttons */
    .btn-group, .d-flex.gap-2 {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn,
    .d-flex.gap-2 .btn {
        width: 100%;
    }
    
    /* Gallery item text */
    .gallery-item-caption {
        font-size: 0.875rem;
    }
    
    .gallery-item-date {
        font-size: 0.75rem;
    }
    
    /* Form inputs */
    .form-control-lg {
        font-size: 1rem;
    }
    
    /* Upload area */
    .file-upload-area {
        padding: 1.5rem 0.75rem !important;
    }
    
    /* Cards */
    .card-body {
        padding: 1rem !important;
    }
    
    /* Admin stats */
    .card i {
        font-size: 2rem !important;
    }
    
    .card h3 {
        font-size: 1.25rem !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .memorial-header {
        padding: 1.5rem 0 !important;
    }
    
    .header-image-container {
        max-width: 200px;
    }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn, .nav-btn, .filter-btn {
        min-height: 44px;
    }
    
    .gallery-item {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(44, 95, 111, 0.1);
    }
    
    /* Remove hover effects on touch devices */
    .nav-btn:hover,
    .btn:hover {
        transform: none;
    }
}

/* View Transitions */
.view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

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

/* Bootstrap Overrides */
.btn-primary {
    background: var(--accent-color);
    border-color: var(--accent-color);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-color-dark);
    border-color: var(--accent-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(187, 143, 0, 0.4);
}

.btn-outline-primary {
    color: var(--accent-color);
    border-color: var(--accent-color);
    font-weight: 600;
}

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

.text-primary {
    color: var(--accent-color) !important;
}

.card {
    border: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-radius: 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(233, 69, 96, 0.15);
}

/* Contributors Card */
.contributors-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.contributors-card:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.contributors-card:active {
    transform: translateY(-2px);
}
