/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700&display=swap');

:root {
    --primary-color: #ff8e8e;
    /* Pasel Pink */
    --secondary-color: #6c5ce7;
    /* Magic Purple */
    --accent-color: #fdcb6e;
    /* Gold */
    --bg-color: #ffeaa7;
    /* Cream */
    --text-color: #2d3436;
    --card-bg: #ffffff;
    --border-radius: 16px;
    --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 4px solid var(--accent-color);
}

h1 {
    color: var(--secondary-color);
    text-shadow: 2px 2px 0px #fdcb6e;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

.sticky-counter {
    background: linear-gradient(135deg, var(--secondary-color), #a29bfe);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    display: inline-block;
    font-weight: bold;
    font-size: 1.3rem;
    position: sticky;
    top: 20px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.4);
    border: 2px solid white;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.character-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    user-select: none;
    border: 4px solid white;
    position: relative;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

.character-card.selected {
    border-color: var(--primary-color);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-color: #f0f0f0;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.character-card:hover .card-image img {
    transform: scale(1.05);
}

.vote-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

.card-info {
    padding: 15px;
    text-align: center;
    background: white;
    border-bottom: 2px dashed #eee;
}

.card-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.description {
    font-size: 0.85rem;
    color: #666;
    margin-top: 8px;
    margin-bottom: 0;
    line-height: 1.4;
    text-align: left;
    white-space: pre-wrap;
    /* Show line breaks */
    max-height: 80px;
    /* Limit height */
    overflow-y: auto;
    /* Scroll if too long */
}


.vote-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    gap: 15px;
    background: #fafafa;
}

.btn-minus,
.btn-plus {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-minus {
    background: #dfe6e9;
    color: #636e72;
}

.btn-plus {
    background: var(--secondary-color);
    color: white;
}

.btn-plus:active,
.btn-minus:active {
    transform: scale(0.9);
}

.btn-minus:disabled,
.btn-plus:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    box-shadow: none;
}

.vote-count {
    font-weight: bold;
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
    color: var(--text-color);
}

.submit-area {
    text-align: center;
    position: sticky;
    bottom: 30px;
    z-index: 100;
    pointer-events: none;
    /* Allows clicking through empty space */
}

#submit-vote {
    pointer-events: auto;
    background: linear-gradient(45deg, var(--primary-color), #ff7675);
    color: white;
    border: none;
    padding: 18px 60px;
    font-size: 1.4rem;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.5);
    transition: transform 0.2s, filter 0.2s;
    border: 4px solid white;
    font-family: inherit;
    font-weight: bold;
}

#submit-vote:disabled {
    background: #b2bec3;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(100%);
}

#submit-vote:not(:disabled):hover {
    transform: translateY(-5px) scale(1.02);
    filter: brightness(110%);
}

/* Messages */
.message {
    text-align: center;
    padding: 40px;
    border-radius: var(--border-radius);
    margin-top: 40px;
    box-shadow: var(--box-shadow);
}

.message.voted {
    background: white;
    border: 4px solid var(--secondary-color);
}

.message.error {
    background: #ff7675;
    color: white;
    border: 4px solid #d63031;
}

/* Admin Specific */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
}

.dashboard-section {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
    box-shadow: var(--box-shadow);
    border: 1px solid white;
}

.action-btn {
    padding: 8px 16px;
    margin: 0 5px;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: white;
    font-family: inherit;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-grid label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--secondary-color);
}

.config-grid input[type="text"],
.config-grid input[type="datetime-local"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 20px 10px;
        margin-bottom: 30px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .sticky-counter {
        font-size: 1rem;
        padding: 8px 20px;
        top: 10px;
    }

    .character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 100px;
        /* Space for fixed button */
    }

    .character-card {
        border-width: 2px;
    }

    .card-info {
        padding: 8px;
    }

    .card-info h3 {
        font-size: 0.9rem;
    }

    .vote-controls {
        padding: 10px 5px;
        gap: 8px;
    }

    /* Larger Touch Targets */
    .btn-minus,
    .btn-plus {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }

    .vote-count {
        width: 24px;
        font-size: 1.2rem;
    }

    /* Fixed Bottom Button for Mobile */
    .submit-area {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        text-align: center;
        padding: 0;
        z-index: 1000;
    }

    #submit-vote {
        width: 100%;
        border-radius: 20px 20px 0 0;
        margin: 0;
        padding: 20px;
        font-size: 1.2rem;
        border: none;
        border-top: 4px solid white;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    #submit-vote:not(:disabled):hover {
        transform: none;
        filter: brightness(110%);
    }

    /* Admin Table Scroll */
    .dashboard-section {
        padding: 15px;
        overflow-x: auto;
    }

    table {
        min-width: 600px;
        /* Force scroll on small screens */
    }
}