/**
 * Kindness Counter - Frontend Styles
 * Uses Elementor classes for inherited styling
 */

/* Container */
.kc-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

/* Progress Ring */
.kc-progress-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 2rem;
}

.kc-progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.kc-progress-ring-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 12;
}

.kc-progress-ring-fill {
    fill: none;
    stroke: currentColor;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48; /* 2 * PI * 90 */
    stroke-dashoffset: calc(565.48 - (565.48 * var(--progress, 0) / 100));
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Counter Display */
.kc-counter-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.kc-count {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
}

.kc-goal-label {
    font-size: 1rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.kc-goal-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    animation: kc-badge-appear 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes kc-badge-appear {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Button Group */
.kc-button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.kc-add-button {
    min-width: 280px;
    position: relative;
    overflow: hidden;
}

.kc-add-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kc-button-pulse {
    animation: kc-pulse 0.3s ease-out;
}

@keyframes kc-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Ripple effect */
.kc-add-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s, opacity 0.6s;
    opacity: 0;
}

.kc-add-button:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: 0s;
}

.kc-undo-button {
    min-width: 150px;
}

/* Kindness Examples */
.kc-examples {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

.kc-examples-title {
    font-weight: 600;
    margin-bottom: 1rem;
}

.kc-examples-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.kc-examples-list li {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Public Message */
.kc-public-message {
    margin-top: 2rem;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Modal */
.kc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.kc-modal.kc-modal-active {
    display: flex;
}

.kc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    animation: kc-fade-in 0.3s;
}

.kc-modal-content {
    position: relative;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: kc-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes kc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kc-slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tag Buttons */
.kc-tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
    justify-content: center;
}

.kc-tag-btn {
    flex: 0 0 auto;
}

.kc-modal-actions {
    margin-top: 1.5rem;
    text-align: center;
}

/* Celebration Modal */
.kc-celebration-modal .kc-modal-content {
    text-align: center;
    padding: 3rem 2rem;
}

.kc-celebration-title {
    font-size: 2.5rem;
    margin: 1rem 0;
}

.kc-celebration-message {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.kc-celebration-animation {
    position: relative;
    height: 200px;
    overflow: hidden;
}

/* Confetti */
.kc-confetti {
    position: absolute;
    top: -50px;
    font-size: 2rem;
    animation: kc-fall linear forwards;
    pointer-events: none;
}

@keyframes kc-fall {
    to {
        transform: translateY(250px) rotate(360deg);
        opacity: 0;
    }
}

/* Error Toast */
.kc-error-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #f44336;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: bottom 0.3s ease;
}

.kc-error-toast.kc-toast-visible {
    bottom: 2rem;
}

/* Contrast Mode */
.kc-container[data-contrast="true"] {
    filter: contrast(1.2);
}

.kc-container[data-contrast="true"] .kc-progress-ring-bg {
    stroke: rgba(0, 0, 0, 0.3);
}

.kc-container[data-contrast="true"] .kc-progress-ring-fill {
    stroke-width: 14;
}

/* Responsive */
@media (max-width: 640px) {
    .kc-progress-wrapper {
        width: 220px;
        height: 220px;
    }
    
    .kc-count {
        font-size: 3rem;
    }
    
    .kc-add-button {
        min-width: 100%;
    }
    
    .kc-examples {
        padding: 1rem;
    }
    
    .kc-modal-content {
        padding: 1.5rem;
    }
}

/* Accessibility */
.kc-add-button:focus,
.kc-undo-button:focus,
.kc-tag-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Loading State */
.kc-add-button.kc-loading {
    pointer-events: none;
}

.kc-add-button.kc-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: kc-spin 0.6s linear infinite;
}

@keyframes kc-spin {
    to { transform: rotate(360deg); }
}
