/* Customizable Variables for Fine-Tuning */
:root {
    /* Colors */
    --primary-green: #198754;
    --accent-green: #80c684;
    --light-gray: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --simpleevent-border: #28a545;
    --referendum-border: #fb7e14;
    --multi_poll-border: #17cbea;

    /* Sizes */
    --card-width: 360px;
    --card-height: 400px;
    --image-height: 160px;
    --title-font-size: 1.1rem;
    --author-avatar-size: 34px;
    --delete-btn-size: 24px;
    --btn-custom-font-size: 0.85rem;

    /* Spacing */
    --card-padding: 0.5rem;
    --section-gap: 0.75rem;
    --image-padding: 3px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Keyframe Animations */
@keyframes slideInFromTop {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: var(--shadow-sm); }
    50% { box-shadow: var(--shadow-md); }
}

@keyframes fadeInScale {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Event Container */
.event-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.event-container.loaded {
    animation: slideInFromTop 0.6s ease-out;
}

/* Event Card */
.event-card {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    padding: 15px;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(37, 175, 180, 0.2);
    animation: pulseGlow 1.5s infinite;
}

/* Border Styles for Event Types */
.event-card.border-simpleevent { border: 2px solid var(--simpleevent-border); }
.event-card.border-referendum { border: 2px solid var(--referendum-border); }
.event-card.border-multi_poll { border: 2px solid var(--multi_poll-border); }

/* Type Label */
.type-label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 1px 14px 1px 16px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 100;
    color: #fff;
    z-index: 10;
    transition: transform 0.3s ease;
}

.type-label:hover {
    transform: scale(1.05);
}

.type-label-simpleevent { background: linear-gradient(45deg, #28a545, #57ec78); }
.type-label-referendum { background: linear-gradient(45deg, #fb7e14, #fca967); }
.type-label-multi_poll { background: linear-gradient(45deg, #17cbea, #7ed4e3); }

/* Delete Button */
.event-card .btn-danger {
    background: rgba(220, 53, 69, 0);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0);
    border-radius: 50%;
    width: var(--delete-btn-size);
    height: var(--delete-btn-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    position: absolute;
    top: -2px;
    right: -2px;
    z-index: 10;
    padding: 0;
}

.event-card .btn-danger:hover {
    background: rgba(255, 255, 255, 0.2);
    color: red;
    transform: scale(2.1);
    border-color: rgba(255, 255, 255, 0.02);
}

/* Event Image Container */
.event-image-container {
    width: 100%;
    height: var(--image-height);
    overflow: hidden;
    border-radius: 10px;
    padding: var(--image-padding);
}

.event-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 7px;
    transition: transform 0.4s ease;
}

.event-image:hover {
    transform: scale(1.05);
}

.event-image.default-logo {
    object-fit: contain;
    background: #ffffff;
    padding: 1rem;
}

/* Card Body */
.card-body {
    padding: var(--card-padding);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
}

/* Event Title */
.card-title {
    font-size: var(--title-font-size);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    padding: 0 10px;
    background: linear-gradient(90deg, rgba(37, 175, 180, 0.05), rgba(255, 255, 255, 0.95));
    border-bottom: 1px solid var(--accent-green);
    transition: transform 0.3s ease;
}

.card-title:hover {
    transform: translateX(3px);
}

/* Author and Date Block */
.author-date-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 5px;
    border-radius: 6px;
    background: #f3f3f3;
    box-shadow: var(--shadow-sm);
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: var(--author-avatar-size);
    height: var(--author-avatar-size);
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--accent-green);
    transition: transform 0.3s ease;
}

.author-avatar:hover {
    transform: scale(1.1);
}

.author-info .fw-bold {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 0;
}

.author-info .text-muted {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.date-info {
    text-align: right;
}

.date-info .fw-bold,
.date-info .text-muted {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Online/Offline Status */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.bg-success { background: var(--primary-green); }
.bg-danger { background: #dc3545; }

/* Event Stats */
.event-stats {
    padding: 0 5px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-item .fw-bold {
    color: var(--text-primary);
}

/* Custom Button */
.btn-custom {
    background: linear-gradient(45deg, var(--accent-green), var(--primary-green));
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    font-size: var(--btn-custom-font-size);
    font-weight: 600;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    width: fit-content;
    align-self: flex-start;
}

.btn-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: transform 0.4s ease;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 175, 180, 0.3);
    color: white;
}

.btn-custom:hover::before {
    transform: translateX(100%);
}

/* Delete Modal */
.custom-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    z-index: 1500;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;

}

.custom-modal.active {
    opacity: 1;
}

.custom-modal-dialog {
    max-width: 500px;
    width: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    animation: fadeInScale 0.3s ease-in-out;
}

/*.custom-modal.active .custom-modal-dialog {*/
/*    transform: scale(1);*/
/*}*/

.custom-modal-content {
    padding: 1.5rem;
    border-radius: 16px;
    background: #fff;
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.custom-modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 900;
    color: #ad4747;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    line-height: 1;
    filter: grayscale(1);
    transition: filter 0.2s ease;
}

.custom-modal-close:hover {
    color: #000;
    filter: none;
}

.custom-modal-body {
    padding: 1.5rem;
    font-size: 0.8rem;
    color: #333;
}

.custom-modal-footer {
    display: flex;
    justify-content: center;
    gap: 40px;
    border-top: none;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.custom-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 100;
    transition: background-color 0.2s ease;
}

.custom-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.custom-btn-secondary:hover {
    background: #5a6268;
}

.custom-btn-danger {
    background: #dc3545;
    color: #fff;
}

.custom-btn-danger:hover {
    background: rgba(200, 35, 51, 0.18);
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .event-card {
        width: 100%;
        height: 460px;
    }

    .event-image-container {
        height: calc(var(--image-height) - 20px);
    }

    .author-avatar {
        width: calc(var(--author-avatar-size) - 4px);
        height: calc(var(--author-avatar-size) - 4px);
    }

    .author-info .fw-bold,
    .date-info .fw-bold,
    .stat-item .fw-bold {
        font-size: 0.8rem;
    }

    .author-info .text-muted,
    .date-info .text-muted,
    .stat-item {
        font-size: 0.7rem;
    }

    .btn-custom {
        font-size: calc(var(--btn-custom-font-size) - 0.05rem);
        padding: 0.4rem 0.9rem;
    }
}