/* =================================================================
   Pubblicazioni Giornale — Frontend Styles
   ================================================================= */

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

/* ---- CSS Variables ---- */
:root {
    --pg-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --pg-primary: #1e3a5f;
    --pg-primary-light: #2a5298;
    --pg-primary-dark: #0f2744;
    --pg-accent: #e8443a;
    --pg-accent-hover: #d63830;
    --pg-bg: #f4f6f9;
    --pg-card-bg: #ffffff;
    --pg-border: #e2e6ec;
    --pg-text: #1a1a2e;
    --pg-text-muted: #6b7280;
    --pg-success: #059669;
    --pg-success-bg: #ecfdf5;
    --pg-error: #dc2626;
    --pg-error-bg: #fef2f2;
    --pg-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --pg-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --pg-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    --pg-radius: 12px;
    --pg-radius-sm: 8px;
    --pg-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Notices (success/error) ---- */
.pg-notice {
    font-family: var(--pg-font);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--pg-radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    animation: pg-slideDown 0.35s ease-out;
}

.pg-notice--success {
    background: var(--pg-success-bg);
    color: var(--pg-success);
    border: 1px solid #a7f3d0;
}

.pg-notice--error {
    background: var(--pg-error-bg);
    color: var(--pg-error);
    border: 1px solid #fecaca;
}

.pg-notice__icon {
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

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

/* ---- Upload Section ---- */
.pg-upload-section {
    font-family: var(--pg-font);
    background: var(--pg-card-bg);
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    padding: 28px 32px;
    margin-bottom: 36px;
    box-shadow: var(--pg-shadow-sm);
    transition: box-shadow var(--pg-transition);
}

.pg-upload-section:hover {
    box-shadow: var(--pg-shadow-md);
}

.pg-upload-header {
    margin-bottom: 20px;
}

.pg-upload-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--pg-primary);
    margin: 0;
    padding: 0;
    letter-spacing: -0.01em;
}

.pg-upload-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* ---- Form ---- */
.pg-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .pg-form-grid {
        grid-template-columns: 1fr;
    }
}

.pg-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-label {
    font-family: var(--pg-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pg-input {
    font-family: var(--pg-font);
    padding: 12px 16px;
    border: 1.5px solid var(--pg-border);
    border-radius: var(--pg-radius-sm);
    font-size: 15px;
    color: var(--pg-text);
    background: var(--pg-bg);
    transition: border-color var(--pg-transition), box-shadow var(--pg-transition);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.pg-input:focus {
    border-color: var(--pg-primary-light);
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.12);
}

.pg-input::placeholder {
    color: var(--pg-text-muted);
    opacity: 0.7;
}

/* ---- Custom File Input ---- */
.pg-file-input-wrapper {
    position: relative;
}

.pg-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.pg-file-input-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px dashed var(--pg-border);
    border-radius: var(--pg-radius-sm);
    background: var(--pg-bg);
    transition: border-color var(--pg-transition), background var(--pg-transition);
    cursor: pointer;
}

.pg-file-input-wrapper:hover .pg-file-input-display,
.pg-file-input:focus + .pg-file-input-display {
    border-color: var(--pg-primary-light);
    background: rgba(42, 82, 152, 0.03);
}

.pg-file-selected .pg-file-input-display {
    border-color: var(--pg-success);
    border-style: solid;
    background: var(--pg-success-bg);
}

.pg-file-icon {
    width: 20px;
    height: 20px;
    color: var(--pg-text-muted);
    flex-shrink: 0;
}

.pg-file-selected .pg-file-icon {
    color: var(--pg-success);
}

.pg-file-label {
    font-family: var(--pg-font);
    font-size: 14px;
    color: var(--pg-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-file-selected .pg-file-label {
    color: var(--pg-success);
    font-weight: 500;
}

/* ---- Submit Button ---- */
.pg-submit-btn {
    font-family: var(--pg-font);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--pg-primary) 0%, var(--pg-primary-light) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--pg-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--pg-transition), box-shadow var(--pg-transition), opacity var(--pg-transition);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
    letter-spacing: 0.01em;
}

.pg-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30, 58, 95, 0.35);
}

.pg-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(30, 58, 95, 0.2);
}

.pg-btn-icon {
    width: 18px;
    height: 18px;
}

/* ---- Publications Grid ---- */
.pg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 36px;
}

@media (max-width: 540px) {
    .pg-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

/* ---- Publication Card ---- */
.pg-card {
    font-family: var(--pg-font);
    position: relative;
    background: var(--pg-card-bg);
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius);
    overflow: hidden;
    box-shadow: var(--pg-shadow-sm);
    transition: transform var(--pg-transition), box-shadow var(--pg-transition);
}

.pg-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pg-shadow-lg);
}

.pg-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.pg-card__image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: linear-gradient(145deg, #e8ecf2, #d1d8e4);
}

.pg-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.4s ease;
}

.pg-card:hover .pg-card__image {
    transform: scale(1.04);
}

/* ---- Overlay on hover ---- */
.pg-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 39, 68, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--pg-transition);
}

.pg-card:hover .pg-card__overlay {
    opacity: 1;
}

.pg-card__overlay-icon {
    width: 40px;
    height: 40px;
    color: #ffffff;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
    transition: transform var(--pg-transition);
}

.pg-card:hover .pg-card__overlay-icon {
    transform: scale(1.1);
}

/* ---- Placeholder (no thumbnail) ---- */
.pg-card__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(145deg, #e8ecf2, #cdd5e1);
}

.pg-card__pdf-icon {
    width: 56px;
    height: 56px;
    color: var(--pg-primary);
    opacity: 0.5;
}

.pg-card__pdf-label {
    font-family: var(--pg-font);
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-primary);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ---- Card Info ---- */
.pg-card__info {
    padding: 16px 18px;
}

.pg-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--pg-text);
    margin: 0 0 4px 0;
    padding: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pg-card__date {
    font-size: 12px;
    color: var(--pg-text-muted);
    font-weight: 500;
}

/* ---- Delete Button ---- */
.pg-card__delete {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: var(--pg-error);
    text-decoration: none;
    opacity: 0;
    transition: opacity var(--pg-transition), background var(--pg-transition), transform var(--pg-transition);
}

.pg-card:hover .pg-card__delete {
    opacity: 1;
}

.pg-card__delete:hover {
    background: var(--pg-error);
    color: #ffffff;
    transform: scale(1.1);
}

.pg-card__delete svg {
    width: 16px;
    height: 16px;
}

/* ---- Pagination ---- */
.pg-pagination {
    font-family: var(--pg-font);
    margin: 32px 0;
    display: flex;
    justify-content: center;
}

.pg-pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pg-pagination li {
    margin: 0;
    padding: 0;
}

.pg-pagination a,
.pg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--pg-text);
    text-decoration: none;
    background: var(--pg-card-bg);
    transition: all var(--pg-transition);
}

.pg-pagination a:hover {
    background: var(--pg-primary);
    color: #ffffff;
    border-color: var(--pg-primary);
    box-shadow: var(--pg-shadow-sm);
}

.pg-pagination .current {
    background: var(--pg-primary);
    color: #ffffff;
    border-color: var(--pg-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

/* ---- Empty State ---- */
.pg-empty {
    font-family: var(--pg-font);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--pg-text-muted);
}

.pg-empty__icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.35;
    color: var(--pg-primary);
}

.pg-empty p {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}
