/* =============================================
   Goals Module — Glassmorphism Savings Tracker
   ============================================= */

/* Summary Bar */
.goals-summary-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.goals-summary-bar .glass-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.summary-icon.icon-active {
    background: linear-gradient(135deg, #f97316, #ef4444);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.summary-icon.icon-done {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.summary-data {
    display: flex;
    flex-direction: column;
}

.summary-locked-amount {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-count {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
}

/* Action Bar */
.goals-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.goals-action-bar h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
}

/* Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Goal Card */
.goal-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: var(--transition-smooth);
    overflow: hidden;
}

.goal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--goal-color, var(--accent-primary));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.goal-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
    border-color: var(--goal-color, var(--accent-primary));
}

.goal-card.completed {
    border-color: var(--accent-success);
}

.goal-card.completed::before {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Card Header */
.goal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.goal-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.goal-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.goal-icon-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    border-radius: inherit;
}

.goal-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

.goal-deadline {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.goal-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Progress Ring */
.goal-progress-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.progress-ring-container {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.progress-ring-svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--goal-color, var(--accent-primary));
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px var(--goal-color, var(--accent-primary)));
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.95rem;
    font-weight: 800;
}

.goal-amounts {
    flex: 1;
}

.goal-amounts .saved-amount {
    font-size: 1.3rem;
    font-weight: 800;
}

.goal-amounts .target-amount {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.goal-amounts .remaining-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Linear Progress Fallback */
.goal-linear-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.goal-linear-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.goal-linear-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Card Actions */
.goal-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.goal-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.goal-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.goal-btn.btn-fund {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.goal-btn.btn-fund:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.goal-btn.btn-danger {
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.goal-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-danger);
}

/* Completed Checkmark Overlay */
.goal-card.completed .goal-icon-wrapper::before {
    content: '✓';
    position: absolute;
    z-index: 2;
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
}

/* Empty State */
.goals-empty-state {
    text-align: center;
    padding: 5rem 2rem;
}

.empty-icon-wrapper {
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem auto;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    animation: float 3s ease-in-out infinite;
}

.empty-icon-wrapper i {
    width: 40px;
    height: 40px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.goals-empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.goals-empty-state p {
    max-width: 360px;
    margin: 0 auto 2rem auto;
}

/* === Modal Internals === */

/* Icon Selector Grid */
.icon-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.icon-option {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-option:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.icon-option.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Color Selector */
.goal-color-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.goal-color-radio {
    display: none;
}

.goal-color-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 3px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.goal-color-radio:checked + .goal-color-bubble {
    border-color: var(--text-main);
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.form-row-goals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Fund Modal */
.fund-goal-info {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
}

.fund-goal-name {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0.3rem;
}

.fund-goal-progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.fund-tabs {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-secondary);
    padding: 0.4rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.fund-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    background: transparent;
    padding: 0.7rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
    font-size: 0.9rem;
}

.fund-tab.active[data-fund-type="deposit"] {
    background: var(--accent-success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.fund-tab.active[data-fund-type="withdraw"] {
    background: var(--accent-warning);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Celebration Particles */
.goal-celebration {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confetti-fall 1.5s ease-out forwards;
}

@keyframes confetti-fall {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--x, 50px), var(--y, 200px)) rotate(720deg); opacity: 0; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .goals-summary-bar {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .goals-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row-goals {
        grid-template-columns: 1fr;
    }
    
    .goal-progress-section {
        flex-direction: column;
        text-align: center;
    }
    
    .goal-card-actions {
        flex-direction: column;
    }
    
    .goal-btn {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .goals-summary-bar {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .goals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
