:root {
    --font-family: 'Rubik', sans-serif;

    /* Color Palette */
    --bg-color: #f8f9fa;
    --text-color: #343a40;
    --card-bg: #ffffff;

    --color-meetings: #4361ee;
    --color-meetings-light: #e8ebff;

    --color-references: #2ec4b6;
    --color-references-light: #e0fbf9;

    --color-thanks: #f72585;
    --color-thanks-light: #ffebf5;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --radius: 16px;
    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #212529;
}


/* Grid Layout */
.grid {
    display: flex;
    /* Changed from grid to flex to force single row */
    flex-wrap: nowrap;
    /* Prevent wrapping */
    gap: 1.8rem;
    width: 100%;
    margin-bottom: 4rem;
    overflow: hidden;
    /* overflow-x: auto; */
    /* Add horizontal scroll on very small screens if needed */
}

/* Ensure cards take equal width */
.card {
    flex: 1;
    min-width: 280px;
    /* Minimum width to prevent crushing */
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
    /* Ensure relative positioning for coin container */
    position: relative;
    overflow: hidden;
    /* Keep coins inside the card */
}

/* Coin Animation */
.coin {
    position: fixed;
    width: 40px;
    /* Slightly larger to show the coin effect */
    height: 40px;
    background-image: url('favicon.ico');
    background-size: 65%;
    /* Make icon smaller to fit inside coin */
    background-position: center;
    background-repeat: no-repeat;
    background-color: #ffd700;
    /* Gold color */
    border: 3px solid #daa520;
    /* Darker gold border */
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    /* Shine and shadow */
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center initially */
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    animation: explode 1s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(1);
        opacity: 0;
    }
}

/* Shake Animation */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-2deg);
    }

    50% {
        transform: translateX(5px) rotate(2deg);
    }

    75% {
        transform: translateX(-5px) rotate(-2deg);
    }

    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

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

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-value {
    font-size: 2.5rem;
    /* Adjusted to fit 9,999,999 NIS in the card */
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
    /* Remove bottom margin as spacing is handled by container */
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: bidi-override;
}

/* Specific adjustment for the thanks sum to ensure it fits */
#sum-thanks.counter-value {
    font-size: 2.2rem;
}

@media (min-width: 1200px) {
    .counter-value {
        font-size: 3rem;
    }

    #sum-thanks.counter-value {
        font-size: 2.5rem;
    }
}

/* Specific Card Styling */
.card-meetings:hover {
    border-color: var(--color-meetings-light);
}

.card-meetings .counter-value {
    color: var(--color-meetings);
}

.card-meetings .card-icon {
    background: var(--color-meetings-light);
}

.card-references:hover {
    border-color: var(--color-references-light);
}

.card-references .counter-value {
    color: var(--color-references);
}

.card-references .card-icon {
    background: var(--color-references-light);
}

.card-thanks:hover {
    border-color: var(--color-thanks-light);
}

.card-thanks .counter-value {
    color: var(--color-thanks);
}

.card-thanks .card-icon {
    background: var(--color-thanks-light);
}

.counter-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    /* Allow this to grow to push actions down if needed, though margin-top: auto handles it */
    justify-content: center;
    /* Center the number vertically in the available space */
}

.counter-display .counter-value {
    margin-bottom: 0.25rem;
}

.sub-counter {
    font-size: 1.1rem;
    color: #868e96;
    font-weight: 500;
}

.sub-counter span {
    font-weight: 700;
    color: var(--color-thanks);
}

.card-actions {
    margin-top: auto;
    width: 100%;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:active {
    transform: scale(0.98);
}

.btn-meetings {
    background-color: var(--color-meetings);
}

.btn-meetings:hover {
    background-color: #304ddb;
}

.btn-references {
    background-color: var(--color-references);
}

.btn-references:hover {
    background-color: #20a99c;
}

.btn-thanks {
    background-color: var(--color-thanks);
}

.btn-thanks:hover {
    background-color: #d90467;
}

/* Input Group */
.input-group {
    width: 100%;
}

input[type="number"] {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    direction: ltr;
    font-family: var(--font-family);
    font-size: 1rem;
    text-align: center;
    transition: var(--transition);
    outline: none;
}

input[type="number"]:focus {
    border-color: #adb5bd;
    background-color: #fff;
}

.card-meetings input:focus {
    border-color: var(--color-meetings);
}

.card-references input:focus {
    border-color: var(--color-references);
}

.card-thanks input:focus {
    border-color: var(--color-thanks);
}

/* Footer & Reset */
footer {
    text-align: center;
    width: 100%;
    padding-bottom: 2rem;
}

.btn-reset {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #868e96;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-reset:hover {
    border-color: #fa5252;
    color: #fa5252;
    background: #fff5f5;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .grid {
        gap: 1rem;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Remove default number input arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}