/* frontend/style.css */
body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    background-color: white;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

h1 {
    text-align: center;
    color: #333;
}

label {
    font-size: 16px;
    margin-bottom: 8px;
    display: block;
    color: #555;
}

input[type="text"], input[type="number"], input[type="tel"], select {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

select {
    cursor: pointer;
}

button {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    width: 100%;
    cursor: pointer;
}

button:hover {
    background-color: #45a049;
}

.amount {
    font-weight: bold;
    color: #333;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    button {
        padding: 12px;
    }
}

input[type="date"] {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

input[type="date"]:invalid {
    border-color: #dc3545;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 4px;
    display: none;
}

input[type="date"]:invalid + .error-message {
    display: block;
}

/* Table Styles */
.table {
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
}

/* Filter Button Styles */
#filter-group .btn,
#shift-filter-group .btn {
    border-radius: 0;
    transition: all 0.3s ease;
}

#filter-group .btn:first-child,
#shift-filter-group .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

#filter-group .btn:last-child,
#shift-filter-group .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

#filter-group .btn.active,
#shift-filter-group .btn.active {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Responsive adjustments for filter buttons */
@media (max-width: 768px) {
    #filter-group,
    #shift-filter-group {
        margin-bottom: 1rem;
    }
    
    #filter-group .btn,
    #shift-filter-group .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Search and Filter Controls */
.input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-group .btn {
    min-width: 100px;
}

/* Member Status Badges */
.badge {
    padding: 8px 12px;
    font-size: 0.9em;
}

/* Profile Images */
.rounded-circle {
    border: 2px solid #dee2e6;
}

/* Registration Form */
.card {
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border: none;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
    border-color: #86b7fe;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .btn-group {
        margin-top: 1rem;
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
    }
    
    .table-responsive {
        margin: 0 -15px;
    }
}

/* General Styles */
body {
    background-color: #f8f9fa;
}

/* Table Styles */
.table-responsive {
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.table th {
    white-space: nowrap;
    background-color: #f8f9fa;
}

.table td {
    vertical-align: middle;
}

/* Profile Image */
.profile-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
}

/* Status Badge */
.badge {
    padding: 0.5em 0.75em;
    font-size: 0.875rem;
}

/* Search and Filter Controls */
.input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Modal Styles */
.modal-dialog {
    margin: 1rem;
}

.modal-content {
    border-radius: 0.5rem;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }

    .table th, .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .profile-img {
        width: 40px;
        height: 40px;
    }

    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .form-label {
        font-size: 0.875rem;
    }

    .form-control, .form-select {
        font-size: 0.875rem;
    }

    /* Stack table cells on mobile */
    @media (max-width: 776px) {
        .table-responsive {
            border: 0;
        }

        .table thead {
            display: none;
        }

        .table tbody tr {
            display: block;
            margin-bottom: 1rem;
            border: 1px solid #dee2e6;
            border-radius: 0.375rem;
            background-color: #fff;
        }

        .table tbody td {
            display: block;
            text-align: right;
            padding: 0.5rem;
            border: none;
            position: relative;
            padding-left: 50%;
        }

        .table tbody td::before {
            content: attr(data-label);
            position: absolute;
            left: 0.5rem;
            width: 45%;
            text-align: left;
            font-weight: bold;
        }

        .table tbody td:first-child {
            border-top: none;
        }

        .table tbody td:last-child {
            border-bottom: none;
        }
    }
}

/* Button Styles */
.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-primary:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

/* Action Buttons */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn-group .btn {
    flex: 1;
    white-space: nowrap;
}

/* Delete Confirmation Modal */
#deleteConfirmModal .modal-content {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#deleteConfirmModal .modal-header {
    background-color: #dc3545;
    color: white;
}

#deleteConfirmModal .modal-body {
    padding: 1.5rem;
    text-align: center;
}

#deleteConfirmModal .modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
}

/* Mobile Responsive Styles for Buttons */
@media (max-width: 576px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin: 0.25rem 0;
    }

    #deleteConfirmModal .modal-dialog {
        margin: 0.5rem;
    }
}

/* Animation */
.fade {
    transition: opacity 0.15s linear;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: none;
}

.loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image Optimization Styles */
.profile-img {
    transition: opacity 0.3s ease, transform 0.2s ease;
    will-change: opacity, transform;
}

.profile-img.lazy {
    opacity: 0.7;
    filter: grayscale(20%);
}

.profile-img:not(.lazy) {
    opacity: 1;
    filter: none;
}

.profile-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.profile-img:not([src]) {
    opacity: 0;
}

.profile-img[src] {
    opacity: 1;
}

.profile-placeholder {
    transition: all 0.3s ease;
    cursor: pointer;
}

.profile-placeholder:hover {
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
    transform: scale(1.05);
}

/* Loading animation for images */
.profile-img.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .profile-img {
        transition: opacity 0.2s ease;
    }
    
    .profile-img.lazy {
        opacity: 0.8;
    }
    
    /* Reduce animation complexity on mobile for better performance */
    .profile-img:hover {
        transform: none;
        box-shadow: none;
    }
    
    .profile-placeholder:hover {
        transform: none;
    }
}

/* Current Image Preview Styles */
.current-image-container {
    padding: 10px;
}

.current-image-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid #dee2e6;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.current-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.placeholder-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 12px;
    text-align: center;
}

.placeholder-image i {
    font-size: 24px;
    margin-bottom: 4px;
}

.placeholder-image .small {
    font-size: 10px;
    line-height: 1;
}

/* Hover effect for current image preview */
.current-image-preview:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    transition: all 0.3s ease;
}

/* New image selection state */
.current-image-preview.new-image {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Animation for new image selection */
.current-image-preview.new-image {
    animation: newImagePulse 2s ease-in-out;
}

@keyframes newImagePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive adjustments for current image preview */
@media (max-width: 768px) {
    .current-image-preview {
        width: 60px;
        height: 60px;
    }
    
    .placeholder-image i {
        font-size: 20px;
    }
    
    .placeholder-image .small {
        font-size: 9px;
    }
}

/* Image preview modal optimizations */
#imagePreviewModal .modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: none;
}

#imagePreviewModal .modal-header {
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
}

#imagePreviewModal .modal-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: #ffffff;
}

#imagePreviewModal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

#imagePreviewModal .btn-close-white:hover {
    opacity: 1;
    transform: scale(1.1);
}

#imagePreviewModal .modal-body {
    padding: 1.5rem;
    text-align: center;
}

#previewImage {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

#previewImage:hover {
    transform: scale(1.02);
}

/* Responsive adjustments for image preview modal */
@media (max-width: 768px) {
    #imagePreviewModal .modal-dialog {
        margin: 1rem;
    }
    
    #imagePreviewModal .modal-header {
        padding: 0.75rem 1rem;
    }
    
    #imagePreviewModal .modal-title {
        font-size: 1.1rem;
    }
    
    #imagePreviewModal .modal-body {
        padding: 1rem;
    }
    
    #previewImage {
        max-height: 60vh;
    }
}
