/* Frontend styles for E-Paper Gallery and Upload/List */
/* Base padding for larger screens */
.epaper-gallery-container,
.epaper-upload-form-container,
.epaper-list-container {
    padding: 20px; /* Default padding for desktop/larger screens */
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif; /* Using Inter font as per guidelines */
}

.epaper-gallery-title,
.epaper-upload-form-title,
.epaper-list-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2.5em;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.epaper-gallery-title::after,
.epaper-upload-form-title::after,
.epaper-list-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: #0073aa; /* WordPress blue */
    border-radius: 2px;
}

/* Gallery Grid Styles */
/* Increased specificity for .epaper-grid to help override theme/other plugin styles */
.epaper-gallery-container .epaper-grid {
    display: grid;
    /* Desktop/Tablet: auto-fill columns, min width 250px, fluid width */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    justify-content: center; /* Center the grid items if there's extra space */
}

.epaper-item {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.epaper-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.epaper-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.epaper-thumbnail { /* Styling for the thumbnail container */
    background-color: #f0f0f0;
    display: flex;
    justify-content: center; /* Center image horizontally */
    align-items: flex-start; /* Align image to the top vertically */
    padding: 0; /* No padding around the image */
    height: 250px; /* Fixed height for consistent gallery item size */
    width: 100%; /* Take full width of parent column */
    box-sizing: border-box;
    overflow: hidden; /* Ensure cropping happens cleanly */
}

.epaper-thumbnail img { /* Styling for uploaded image thumbnails */
    width: 100%; /* Fill container width */
    height: 100%; /* Fill container height */
    object-fit: cover; /* Scale to cover the container, cropping if aspect ratio doesn't match */
    object-position: top center; /* Align image to the top and center horizontally */
    border-radius: 0; /* Remove specific border-radius from image to match container */
    box-shadow: none; /* Remove specific box-shadow from image */
}

.epaper-thumbnail svg { /* Styling for fallback SVG icon (if no thumbnail image) */
    max-width: 100px;
    height: auto;
    color: #0073aa;
    opacity: 0.8;
}

.epaper-info {
    padding: 15px; /* Padding for the date area below the thumbnail */
    text-align: center;
    flex-grow: 1; /* Allows info section to expand */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center date vertically within its info box */
}

.epaper-info .epaper-title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0; /* Remove all default margins */
    color: #333;
    line-height: 1.2; /* Adjust line height for better spacing */
}

/* Removed .epaper-view-text as the 'देखें' button is no longer part of HTML */


.no-epapers-message {
    text-align: center;
    font-size: 1.2em;
    color: #555;
    padding: 50px 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-top: 30px;
}

/* Frontend Upload/Edit Form Styles */
.epaper-upload-form-container {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
    max-width: 600px; /* Limit form width */
}

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

.epaper-upload-form-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

.epaper-upload-form-container input[type="file"],
.epaper-upload-form-container input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box; /* Include padding in width */
}

.epaper-upload-form-container .description {
    font-size: 0.85em;
    color: #777;
    margin-top: 5px;
}

.epaper-upload-form-container .current-file-info {
    font-size: 0.9em;
    color: #555;
    margin-top: -10px; /* Adjust spacing */
    margin-bottom: 10px;
}

.epaper-upload-form-container .current-file-info img {
    vertical-align: middle;
    margin-left: 10px;
    max-width: 80px;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}


.epaper-submit-button {
    background-color: #0073aa;
    color: #fff;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: block; /* Make button full width */
    width: 100%;
    text-align: center;
}

.epaper-submit-button:hover {
    background-color: #005177;
    transform: translateY(-2px);
}

/* Frontend message styles (for success/error on redirect) */
.epaper-frontend-message {
    padding: 15px;
    margin: 20px auto;
    border-radius: 8px;
    text-align: center;
    max-width: 800px;
    font-size: 1em;
    font-weight: 500;
}

.epaper-frontend-message p {
    margin: 0;
}

.epaper-frontend-message.success {
    background-color: #e6ffed;
    border: 1px solid #00c25a;
    color: #007c3d;
}

.epaper-frontend-message.error {
    background-color: #ffe6e6;
    border: 1px solid #cc0000;
    color: #cc0000;
}

.epaper-frontend-message.not-logged-in-message {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

/* List View Styles */
.epaper-list-container {
    margin-top: 40px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.epaper-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.epaper-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
    color: #333;
}

.epaper-list-item:last-child {
    border-bottom: none;
}

.epaper-list-item a {
    text-decoration: none;
    color: #0073aa;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-grow: 1; /* Allow link to take available space */
}

.epaper-list-item a:hover {
    text-decoration: underline;
    color: #005177;
}

.list-item-title {
    margin-right: 10px;
    font-weight: 600;
}

.list-item-date {
    font-size: 0.9em;
    color: #666;
}

.list-item-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px; /* Space from date */
}

.list-action-button {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8em; /* Slightly smaller for list view */
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.list-action-button.delete-button {
    background-color: #dc3545; /* Red for delete */
    color: #fff;
}

.list-action-button.delete-button:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}


/* Responsive adjustments */
/* Desktop/Tablet (screen width 769px and up) - Grid layout */
/* Using a more robust selector to ensure this applies */
@media (min-width: 769px) {
    .epaper-gallery-container .epaper-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Min width 250px, fluid columns */
        gap: 25px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    /* Tablet/Medium screens - Force single column if narrower than 769px */
    .epaper-gallery-container .epaper-grid { /* More specific selector */
        grid-template-columns: 1fr; /* Force single column on tablets */
        gap: 20px;
    }
    .epaper-gallery-title,
    .epaper-upload-form-title,
    .epaper-list-title {
        font-size: 2em;
    }
    /* Reduced padding for containers on medium screens */
    .epaper-gallery-container,
    .epaper-upload-form-container,
    .epaper-list-container {
        padding: 15px; /* Reduced padding */
    }
    .epaper-thumbnail {
        height: 250px; /* Keep height consistent with desktop for tablets */
    }
    .epaper-list-item {
        flex-direction: column; /* Stack items in list on small screens */
        align-items: flex-start;
        gap: 5px;
    }
    .epaper-list-item a {
        flex-direction: column;
        align-items: flex-start;
    }
    .list-item-actions {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: flex-start;
    }
    .list-action-button {
        width: auto; /* Allow buttons to size based on content */
        flex-grow: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    /* Mobile screens */
    .epaper-gallery-container .epaper-grid { /* More specific selector */
        grid-template-columns: 1fr; /* Force single column for mobile */
        gap: 15px;
    }
    .epaper-gallery-title,
    .epaper-upload-form-title,
    .epaper-list-title {
        font-size: 1.8em;
    }
    /* Further reduced padding for containers on small screens */
    .epaper-gallery-container,
    .epaper-upload-form-container,
    .epaper-list-container {
        padding: 10px; /* Even smaller padding */
    }
    .epaper-thumbnail {
        height: 200px; /* Shorter height for very small mobile screens */
    }
    .epaper-submit-button {
        padding: 10px 20px;
        font-size: 1em;
    }
}
