trysem commited on
Commit
e57cdf0
·
verified ·
1 Parent(s): 9b07d98

Create rs.jsx

Browse files
Files changed (1) hide show
  1. rs.jsx +527 -0
rs.jsx ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from 'react';
2
+ import { Info, Star, Compass, BookOpen, Sparkles, Moon, Sun, CircleDot } from 'lucide-react';
3
+
4
+ // --- DATA ---
5
+ const nakshatraNamesMalayalam = ["അശ്വതി", "ഭരണി", "കാർത്തിക", "രോഹിണി", "മകയിരം", "തിരുവാതിര", "പുണർതം", "പൂയം", "ആയില്യം", "മകം", "പൂരം", "ഉത്രം", "അത്തം", "ചിത്തിര", "ചോതി", "വിശാഖം", "അനിഴം", "തൃക്കേട്ട", "മൂലം", "പൂരാടം", "ഉത്രാടം", "തിരുവോണം", "അവിട്ടം", "ചതയം", "പൂരുരുട്ടാതി", "ഉത്തൃട്ടാതി", "രേവതി"];
6
+ const nakshatraNamesEng = ["Ashvini", "Bharani", "Krittika", "Rohini", "Mrigashirsha", "Ardra", "Punarvasu", "Pushya", "Ashlesha", "Magha", "Purva Phalguni", "Uttara Phalguni", "Hasta", "Chitra", "Swati", "Vishakha", "Anuradha", "Jyeshtha", "Mula", "Purva Ashadha", "Uttara Ashadha", "Shravana", "Dhanishtha", "Shatabhisha", "Purva Bhadrapada", "Uttara Bhadrapada", "Revati"];
7
+ const rasiNamesMalayalam = ["മേടം", "ഇടവം", "മിഥുനം", "കർക്കടകം", "ചിങ്ങം", "കന്നി", "തുലാം", "വൃശ്ചികം", "ധനു", "മകരം", "കുംഭം", "മീനം"];
8
+ const rasiNamesEng = ["Mesha (Aries)", "Vrisha (Taurus)", "Mithuna (Gemini)", "Karka (Cancer)", "Simha (Leo)", "Kanya (Virgo)", "Tula (Libra)", "Vrishchika (Scorpio)", "Dhanu (Sagittarius)", "Makar (Capricorn)", "Kumbha (Aquarius)", "Meen (Pisces)"];
9
+
10
+ // Vibrant Astrological properties
11
+ const tattvas = { Fire: "അഗ്നി (Fire)", Earth: "ഭൂമി (Earth)", Air: "വായു (Air)", Water: "ജലം (Water)" };
12
+ const rasiDetails = [
13
+ { element: 'Fire', lord: 'Mars' }, { element: 'Earth', lord: 'Venus' }, { element: 'Air', lord: 'Mercury' }, { element: 'Water', lord: 'Moon' },
14
+ { element: 'Fire', lord: 'Sun' }, { element: 'Earth', lord: 'Mercury' }, { element: 'Air', lord: 'Venus' }, { element: 'Water', lord: 'Mars' },
15
+ { element: 'Fire', lord: 'Jupiter' }, { element: 'Earth', lord: 'Saturn' }, { element: 'Air', lord: 'Saturn' }, { element: 'Water', lord: 'Jupiter' }
16
+ ];
17
+
18
+ // Vimshottari Dasha Sequence
19
+ const navagrahaDetails = {
20
+ Ketu: { eng: 'Ketu', mal: 'കേതു', color: '#b45309', textColor: '#ffffff', icon: '☋', type: 'Shadow' }, // Orange-Brown
21
+ Venus: { eng: 'Venus', mal: 'ശുക്രൻ', color: '#ec4899', textColor: '#ffffff', icon: '♀', type: 'Benefic' }, // Vibrant Pink
22
+ Sun: { eng: 'Sun', mal: 'സൂര്യൻ', color: '#dc2626', textColor: '#ffffff', icon: '☉', type: 'Malefic' }, // Red
23
+ Moon: { eng: 'Moon', mal: 'ചന്ദ്രൻ', color: '#f8fafc', textColor: '#0f172a', icon: '☾', type: 'Benefic' }, // Silver/White
24
+ Mars: { eng: 'Mars', mal: 'ചൊവ്വ', color: '#b91c1c', textColor: '#ffffff', icon: '♂', type: 'Malefic' }, // Deep Red
25
+ Rahu: { eng: 'Rahu', mal: 'രാഹു', color: '#334155', textColor: '#ffffff', icon: '☊', type: 'Shadow' }, // Slate
26
+ Jupiter: { eng: 'Jupiter', mal: 'വ്യാഴം', color: '#eab308', textColor: '#ffffff', icon: '♃', type: 'Benefic' }, // Yellow/Gold
27
+ Saturn: { eng: 'Saturn', mal: 'ശനി', color: '#1e3a8a', textColor: '#ffffff', icon: '♄', type: 'Malefic' }, // Deep Blue
28
+ Mercury: { eng: 'Mercury', mal: 'ബുധൻ', color: '#16a34a', textColor: '#ffffff', icon: '☿', type: 'Benefic' } // Emerald Green
29
+ };
30
+ const grahaSequence = ['Ketu', 'Venus', 'Sun', 'Moon', 'Mars', 'Rahu', 'Jupiter', 'Saturn', 'Mercury'];
31
+
32
+ // Vibrant Element Colors for Rasis
33
+ const elementColors = { Fire: '#fca5a5', Earth: '#86efac', Air: '#fde047', Water: '#93c5fd' };
34
+ const elementColorsHover = { Fire: '#f87171', Earth: '#4ade80', Air: '#facc15', Water: '#60a5fa' };
35
+ const nakColors = ['#fdf4ff', '#fff1f2', '#f0fdf4'];
36
+
37
+ // Data Generation
38
+ const rasis = rasiNamesMalayalam.map((name, i) => ({
39
+ type: 'rasi',
40
+ id: i + 1,
41
+ malayalam: name,
42
+ english: rasiNamesEng[i],
43
+ startAngle: i * 30,
44
+ endAngle: (i + 1) * 30,
45
+ color: elementColors[rasiDetails[i].element],
46
+ hoverColor: elementColorsHover[rasiDetails[i].element],
47
+ element: tattvas[rasiDetails[i].element],
48
+ lord: navagrahaDetails[rasiDetails[i].lord]
49
+ }));
50
+
51
+ const nakshatraDegrees = 360 / 27;
52
+ const nakshatras = nakshatraNamesMalayalam.map((name, i) => ({
53
+ type: 'nakshatra',
54
+ id: i + 1,
55
+ malayalam: name,
56
+ english: nakshatraNamesEng[i],
57
+ startAngle: i * nakshatraDegrees,
58
+ endAngle: (i + 1) * nakshatraDegrees,
59
+ color: nakColors[i % 3],
60
+ lord: navagrahaDetails[grahaSequence[i % 9]]
61
+ }));
62
+
63
+ // Navagraha Ring Data (mapped directly to Nakshatras)
64
+ const grahas = nakshatras.map((nak, i) => ({
65
+ ...nak.lord,
66
+ type: 'graha',
67
+ id: `graha-${i}`,
68
+ nakshatraId: nak.id,
69
+ startAngle: nak.startAngle,
70
+ endAngle: nak.endAngle
71
+ }));
72
+
73
+ // --- COMPONENT ---
74
+ export default function App() {
75
+ const [selectedItem, setSelectedItem] = useState(null);
76
+ const [hoveredItem, setHoveredItem] = useState(null);
77
+
78
+ // Geometry Helpers
79
+ const getCoordinates = (cx, cy, radius, angleDeg) => {
80
+ const angleRad = (angleDeg * Math.PI) / 180;
81
+ return {
82
+ x: cx - radius * Math.sin(angleRad),
83
+ y: cy - radius * Math.cos(angleRad)
84
+ };
85
+ };
86
+
87
+ const createArcPath = (cx, cy, innerR, outerR, startAngle, endAngle) => {
88
+ const startOut = getCoordinates(cx, cy, outerR, startAngle);
89
+ const endOut = getCoordinates(cx, cy, outerR, endAngle);
90
+ const startIn = getCoordinates(cx, cy, innerR, startAngle);
91
+ const endIn = getCoordinates(cx, cy, innerR, endAngle);
92
+ const largeArcFlag = endAngle - startAngle > 180 ? 1 : 0;
93
+
94
+ return [
95
+ `M ${startOut.x} ${startOut.y}`,
96
+ `A ${outerR} ${outerR} 0 ${largeArcFlag} 0 ${endOut.x} ${endOut.y}`,
97
+ `L ${endIn.x} ${endIn.y}`,
98
+ `A ${innerR} ${innerR} 0 ${largeArcFlag} 1 ${startIn.x} ${startIn.y}`,
99
+ 'Z'
100
+ ].join(' ');
101
+ };
102
+
103
+ const getTextTransform = (cx, cy, radius, midAngle) => {
104
+ const pos = getCoordinates(cx, cy, radius, midAngle);
105
+ let rotation = -midAngle;
106
+ if (midAngle > 90 && midAngle < 270) rotation += 180;
107
+ return `translate(${pos.x}, ${pos.y}) rotate(${rotation})`;
108
+ };
109
+
110
+ const getOverlapInfo = (rasi, nak) => {
111
+ const overlap = Math.max(0, Math.min(rasi.endAngle, nak.endAngle) - Math.max(rasi.startAngle, nak.startAngle));
112
+ if (overlap < 0.01) return null;
113
+
114
+ const proportion = overlap / nakshatraDegrees;
115
+ let proportionText = ""; let padams = 0;
116
+
117
+ if (proportion >= 0.99) { proportionText = "പൂർണ്ണം (Full)"; padams = 4; }
118
+ else if (proportion >= 0.74) { proportionText = "മുക്കാൽ (3/4)"; padams = 3; }
119
+ else if (proportion >= 0.49) { proportionText = "പകുതി (1/2)"; padams = 2; }
120
+ else if (proportion >= 0.24) { proportionText = "കാൽ (1/4)"; padams = 1; }
121
+
122
+ return { nak, rasi, proportionText, padams };
123
+ };
124
+
125
+ // --- RENDERERS ---
126
+ const renderChart = () => {
127
+ const cx = 400; const cy = 400;
128
+ const centerR = 80; const rasiR = 190; const nakR = 300; const grahaR = 390;
129
+
130
+ return (
131
+ <svg viewBox="0 0 800 800" className="w-full h-auto max-w-3xl drop-shadow-2xl font-sans">
132
+ <defs>
133
+ <filter id="glow" x="-20%" y="-20%" width="140%" height="140%">
134
+ <feDropShadow dx="0" dy="0" stdDeviation="6" floodColor="#ffffff" floodOpacity="0.8" />
135
+ </filter>
136
+ <filter id="shadow" x="-10%" y="-10%" width="120%" height="120%">
137
+ <feDropShadow dx="0" dy="4" stdDeviation="5" floodColor="#000000" floodOpacity="0.3" />
138
+ </filter>
139
+ </defs>
140
+
141
+ {/* Outer Base Ring */}
142
+ <circle cx={cx} cy={cy} r={grahaR} fill="#ffffff" stroke="#cbd5e1" strokeWidth="1" />
143
+
144
+ {/* 1. Navagraha Ring (Outermost) */}
145
+ {grahas.map(graha => {
146
+ const midAngle = (graha.startAngle + graha.endAngle) / 2;
147
+ const isSelected = selectedItem?.type === 'graha' && selectedItem?.eng === graha.eng;
148
+ const isHovered = hoveredItem?.type === 'graha' && hoveredItem?.eng === graha.eng;
149
+ const isAnySelectedOrHovered = selectedItem || hoveredItem;
150
+ const opacity = isAnySelectedOrHovered ? (isSelected || isHovered ? 1 : 0.3) : 1;
151
+
152
+ return (
153
+ <g key={graha.id}
154
+ onClick={(e) => { e.stopPropagation(); setSelectedItem(graha); }}
155
+ onMouseEnter={() => setHoveredItem(graha)}
156
+ onMouseLeave={() => setHoveredItem(null)}
157
+ className="cursor-pointer transition-all duration-300"
158
+ style={{ filter: isSelected ? 'url(#shadow)' : 'none' }}>
159
+ <path
160
+ d={createArcPath(cx, cy, nakR, grahaR, graha.startAngle, graha.endAngle)}
161
+ fill={graha.color}
162
+ fillOpacity={opacity}
163
+ stroke="#ffffff" strokeWidth="1.5"
164
+ />
165
+ <text transform={getTextTransform(cx, cy, (nakR + grahaR) / 2, midAngle)}
166
+ textAnchor="middle" alignmentBaseline="middle"
167
+ className="pointer-events-none transition-opacity duration-300"
168
+ fill={graha.textColor} opacity={opacity}>
169
+ <tspan x="0" dy="-0.6em" className="text-[14px] font-black">{graha.mal}</tspan>
170
+ <tspan x="0" dy="1.4em" className="text-[10px] font-bold uppercase tracking-widest">{graha.eng} {graha.icon}</tspan>
171
+ </text>
172
+ </g>
173
+ );
174
+ })}
175
+
176
+ {/* 2. Nakshatra Ring (Middle) */}
177
+ {nakshatras.map(nak => {
178
+ const midAngle = (nak.startAngle + nak.endAngle) / 2;
179
+ const isSelected = selectedItem?.type === 'nakshatra' && selectedItem?.id === nak.id;
180
+ const isHovered = hoveredItem?.type === 'nakshatra' && hoveredItem?.id === nak.id;
181
+ const isAnySelectedOrHovered = selectedItem || hoveredItem;
182
+ const opacity = isAnySelectedOrHovered ? (isSelected || isHovered ? 1 : 0.3) : 1;
183
+
184
+ const padamDegree = (nak.endAngle - nak.startAngle) / 4;
185
+ const dividers = [1, 2, 3].map(step => {
186
+ const angle = nak.startAngle + step * padamDegree;
187
+ return <line
188
+ key={`div-${nak.id}-${step}`}
189
+ x1={getCoordinates(cx, cy, rasiR + 2, angle).x} y1={getCoordinates(cx, cy, rasiR + 2, angle).y}
190
+ x2={getCoordinates(cx, cy, nakR - 2, angle).x} y2={getCoordinates(cx, cy, nakR - 2, angle).y}
191
+ stroke={isSelected ? '#6366f1' : '#94a3b8'}
192
+ strokeWidth={isSelected ? 1.5 : 0.5} strokeDasharray="3,3" opacity={opacity}
193
+ />;
194
+ });
195
+
196
+ return (
197
+ <g key={`nak-${nak.id}`}
198
+ onClick={(e) => { e.stopPropagation(); setSelectedItem(nak); }}
199
+ onMouseEnter={() => setHoveredItem(nak)}
200
+ onMouseLeave={() => setHoveredItem(null)}
201
+ className="cursor-pointer transition-all duration-300"
202
+ style={{ filter: isSelected ? 'url(#glow)' : 'none' }}>
203
+ <path
204
+ d={createArcPath(cx, cy, rasiR, nakR, nak.startAngle, nak.endAngle)}
205
+ fill={isHovered && !isSelected ? '#fef08a' : nak.color}
206
+ fillOpacity={opacity}
207
+ stroke={isSelected ? '#4338ca' : '#cbd5e1'}
208
+ strokeWidth={isSelected ? 2.5 : 1}
209
+ />
210
+ {dividers}
211
+ <text transform={getTextTransform(cx, cy, (rasiR + nakR) / 2, midAngle)}
212
+ textAnchor="middle" alignmentBaseline="middle"
213
+ className={`pointer-events-none transition-opacity duration-300 ${isSelected ? 'fill-indigo-950' : 'fill-slate-700'}`}
214
+ opacity={opacity}>
215
+ <tspan x="0" dy="-0.6em" className="text-[12px] font-bold tracking-wide">{nak.malayalam}</tspan>
216
+ <tspan x="0" dy="1.4em" className="text-[9px] font-semibold tracking-wider uppercase text-slate-500">{nak.english.split(' ')[0]}</tspan>
217
+ {nak.english.split(' ')[1] && <tspan x="0" dy="1.2em" className="text-[9px] font-semibold tracking-wider uppercase text-slate-500">{nak.english.split(' ')[1]}</tspan>}
218
+ </text>
219
+ </g>
220
+ );
221
+ })}
222
+
223
+ {/* 3. Rasi Ring (Inner) */}
224
+ {rasis.map(rasi => {
225
+ const midAngle = (rasi.startAngle + rasi.endAngle) / 2;
226
+ const isSelected = selectedItem?.type === 'rasi' && selectedItem?.id === rasi.id;
227
+ const isHovered = hoveredItem?.type === 'rasi' && hoveredItem?.id === rasi.id;
228
+ const isAnySelectedOrHovered = selectedItem || hoveredItem;
229
+ const opacity = isAnySelectedOrHovered ? (isSelected || isHovered ? 1 : 0.25) : 1;
230
+
231
+ return (
232
+ <g key={`rasi-${rasi.id}`}
233
+ onClick={(e) => { e.stopPropagation(); setSelectedItem(rasi); }}
234
+ onMouseEnter={() => setHoveredItem(rasi)}
235
+ onMouseLeave={() => setHoveredItem(null)}
236
+ className="cursor-pointer transition-all duration-300"
237
+ style={{ filter: isSelected ? 'url(#glow)' : 'none' }}>
238
+ <path
239
+ d={createArcPath(cx, cy, centerR, rasiR, rasi.startAngle, rasi.endAngle)}
240
+ fill={isHovered ? rasi.hoverColor : rasi.color}
241
+ fillOpacity={opacity}
242
+ stroke={isSelected ? '#4338ca' : '#ffffff'}
243
+ strokeWidth={isSelected ? 3 : 1.5}
244
+ />
245
+ <text transform={getTextTransform(cx, cy, (centerR + rasiR) / 2, midAngle)}
246
+ textAnchor="middle" alignmentBaseline="middle"
247
+ className={`pointer-events-none transition-opacity duration-300 ${isSelected ? 'fill-indigo-950' : 'fill-slate-800'}`}
248
+ opacity={opacity}>
249
+ <tspan x="0" dy="-0.5em" className="text-[16px] font-black tracking-wide">{rasi.id}. {rasi.malayalam}</tspan>
250
+ <tspan x="0" dy="1.5em" className="text-[10px] font-bold tracking-widest text-slate-700 uppercase">{rasi.english}</tspan>
251
+ </text>
252
+ </g>
253
+ );
254
+ })}
255
+
256
+ {/* Center Core */}
257
+ <g filter="url(#shadow)">
258
+ <circle cx={cx} cy={cy} r={centerR} fill="#ffffff" stroke="#e2e8f0" strokeWidth="4" />
259
+ <circle cx={cx} cy={cy} r={centerR - 8} fill="#f1f5f9" stroke="#cbd5e1" strokeWidth="1" strokeDasharray="3,3" />
260
+ <text x={cx} y={cy} textAnchor="middle" alignmentBaseline="middle" className="pointer-events-none">
261
+ <tspan x={cx} dy="-0.8em" className="text-[15px] font-black tracking-widest fill-indigo-900 uppercase">ജ്യോതിഷ</tspan>
262
+ <tspan x={cx} dy="1.2em" className="text-[15px] font-black tracking-widest fill-indigo-900 uppercase">ചക്രം</tspan>
263
+ </text>
264
+ </g>
265
+ </svg>
266
+ );
267
+ };
268
+
269
+ const renderDetails = () => {
270
+ if (!selectedItem) {
271
+ return (
272
+ <div className="flex flex-col h-full bg-white/80 backdrop-blur-xl p-8 rounded-3xl shadow-xl border border-white overflow-y-auto" onClick={(e) => e.stopPropagation()}>
273
+ <div className="flex flex-col items-center justify-center text-slate-400 p-8 text-center border-2 border-dashed border-slate-200/60 bg-gradient-to-b from-slate-50 to-white rounded-2xl mb-8">
274
+ <Compass className="w-14 h-14 mb-4 text-indigo-400 animate-pulse" strokeWidth={1.5} />
275
+ <p className="text-lg font-bold text-slate-700 mb-1">Explore the Chakra</p>
276
+ <p className="text-sm text-slate-500">Select any <span className="font-semibold text-rose-500">Graha</span>, <span className="font-semibold text-indigo-500">Nakshatra</span>, or <span className="font-semibold text-amber-500">Rasi</span> on the wheel to reveal its astrological properties.</p>
277
+ </div>
278
+
279
+ <div className="space-y-5">
280
+ <h3 className="font-bold text-slate-800 text-lg flex items-center gap-2 pb-2 border-b border-slate-100">
281
+ <BookOpen className="w-5 h-5 text-indigo-500"/>
282
+ Vedic Architecture
283
+ </h3>
284
+ <div className="space-y-4 text-sm text-slate-600">
285
+ <div className="grid grid-cols-3 gap-3 text-center">
286
+ <div className="bg-slate-50 p-4 rounded-2xl border border-slate-100 shadow-sm">
287
+ <CircleDot className="w-6 h-6 mx-auto mb-2 text-rose-500" />
288
+ <div className="text-2xl font-black text-slate-800">9</div>
289
+ <div className="text-[10px] font-bold uppercase tracking-wider text-slate-500">Grahas</div>
290
+ </div>
291
+ <div className="bg-slate-50 p-4 rounded-2xl border border-slate-100 shadow-sm">
292
+ <Moon className="w-6 h-6 mx-auto mb-2 text-indigo-400" />
293
+ <div className="text-2xl font-black text-slate-800">27</div>
294
+ <div className="text-[10px] font-bold uppercase tracking-wider text-slate-500">Stars</div>
295
+ </div>
296
+ <div className="bg-slate-50 p-4 rounded-2xl border border-slate-100 shadow-sm">
297
+ <Sun className="w-6 h-6 mx-auto mb-2 text-amber-500" />
298
+ <div className="text-2xl font-black text-slate-800">12</div>
299
+ <div className="text-[10px] font-bold uppercase tracking-wider text-slate-500">Zodiacs</div>
300
+ </div>
301
+ </div>
302
+
303
+ <div className="bg-white p-5 rounded-2xl border border-slate-100 shadow-sm space-y-3">
304
+ <div className="flex justify-between items-center"><span className="text-slate-500">1 Rasi</span><span className="font-bold text-slate-800">30° 00'</span></div>
305
+ <div className="flex justify-between items-center"><span className="text-slate-500">1 Nakshatra</span><span className="font-bold text-slate-800">13° 20'</span></div>
306
+ <div className="flex justify-between items-center"><span className="text-slate-500">1 Padam</span><span className="font-bold text-slate-800">3° 20'</span></div>
307
+ </div>
308
+ <p className="bg-indigo-50/50 p-4 rounded-2xl border border-indigo-100 text-xs text-indigo-900 leading-relaxed font-medium">
309
+ The outermost ring maps the 9 ruling planets (Navagrahas) to their respective Nakshatras in the repeating Vimshottari sequence.
310
+ </p>
311
+ </div>
312
+ </div>
313
+ </div>
314
+ );
315
+ }
316
+
317
+ if (selectedItem.type === 'graha') {
318
+ // Find all Nakshatras ruled by this Graha
319
+ const ruledNaks = nakshatras.filter(n => n.lord.eng === selectedItem.eng);
320
+ // Find all Rasis ruled by this Graha
321
+ const ruledRasis = rasis.filter(r => r.lord.eng === selectedItem.eng);
322
+
323
+ return (
324
+ <div className="flex flex-col h-full bg-white/90 backdrop-blur-xl p-8 rounded-3xl shadow-xl border border-white overflow-y-auto animate-in slide-in-from-right-4 duration-300" onClick={(e) => e.stopPropagation()}>
325
+ <div className="inline-flex items-center self-start px-4 py-1.5 text-white text-[10px] font-bold uppercase tracking-widest rounded-full mb-5 shadow-sm" style={{ backgroundColor: selectedItem.color }}>
326
+ നവഗ്രഹം • Navagraha (Planet)
327
+ </div>
328
+ <div className="flex items-center gap-4 mb-1">
329
+ <h2 className="text-5xl font-black text-slate-800 tracking-tight">{selectedItem.mal}</h2>
330
+ <span className="text-5xl" style={{ color: selectedItem.color }}>{selectedItem.icon}</span>
331
+ </div>
332
+ <p className="text-xl text-slate-500 font-semibold mb-8 tracking-wide">{selectedItem.eng}</p>
333
+
334
+ <div className="grid grid-cols-2 gap-3 mb-8">
335
+ <div className="bg-slate-50 p-4 rounded-2xl border border-slate-100 shadow-sm">
336
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">പ്രകൃതി (Nature)</p>
337
+ <p className="font-bold text-slate-800 text-sm">{selectedItem.type}</p>
338
+ </div>
339
+ <div className="bg-slate-50 p-4 rounded-2xl border border-slate-100 shadow-sm">
340
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">നക്ഷത്രങ്ങൾ (Rules)</p>
341
+ <p className="font-bold text-slate-800 text-sm">3 Nakshatras</p>
342
+ </div>
343
+ </div>
344
+
345
+ <div className="space-y-6">
346
+ <div>
347
+ <div className="flex items-center gap-2 mb-3">
348
+ <Star className="w-4 h-4 text-indigo-500" />
349
+ <h3 className="text-sm font-bold text-slate-800 uppercase tracking-wider">Ruled Nakshatras</h3>
350
+ </div>
351
+ <div className="grid gap-2">
352
+ {ruledNaks.map(n => (
353
+ <div key={n.id} className="p-3 bg-white border border-slate-100 rounded-xl shadow-sm flex justify-between items-center cursor-pointer hover:border-indigo-300 transition-colors" onClick={() => setSelectedItem(n)}>
354
+ <span className="font-bold text-slate-800">{n.malayalam}</span>
355
+ <span className="text-xs font-semibold text-slate-500">{n.english}</span>
356
+ </div>
357
+ ))}
358
+ </div>
359
+ </div>
360
+
361
+ {ruledRasis.length > 0 && (
362
+ <div>
363
+ <div className="flex items-center gap-2 mb-3">
364
+ <Sun className="w-4 h-4 text-amber-500" />
365
+ <h3 className="text-sm font-bold text-slate-800 uppercase tracking-wider">Ruled Zodiac Signs</h3>
366
+ </div>
367
+ <div className="grid gap-2">
368
+ {ruledRasis.map(r => (
369
+ <div key={r.id} className="p-3 bg-white border border-slate-100 rounded-xl shadow-sm flex justify-between items-center cursor-pointer hover:border-amber-300 transition-colors" onClick={() => setSelectedItem(r)}>
370
+ <span className="font-bold text-slate-800">{r.malayalam}</span>
371
+ <span className="text-xs font-semibold text-slate-500">{r.english}</span>
372
+ </div>
373
+ ))}
374
+ </div>
375
+ </div>
376
+ )}
377
+ </div>
378
+ </div>
379
+ );
380
+ }
381
+
382
+ if (selectedItem.type === 'rasi') {
383
+ const innerNaks = nakshatras.map(nak => getOverlapInfo(selectedItem, nak)).filter(Boolean);
384
+ return (
385
+ <div className="flex flex-col h-full bg-white/90 backdrop-blur-xl p-8 rounded-3xl shadow-xl border border-white overflow-y-auto animate-in slide-in-from-right-4 duration-300" onClick={(e) => e.stopPropagation()}>
386
+ <div className="inline-flex items-center self-start px-4 py-1.5 bg-amber-100 text-amber-800 text-[10px] font-bold uppercase tracking-widest rounded-full mb-5 shadow-sm border border-amber-200">
387
+ രാശി • Zodiac Sign
388
+ </div>
389
+ <h2 className="text-5xl font-black text-slate-800 mb-1 tracking-tight">{selectedItem.malayalam}</h2>
390
+ <p className="text-xl text-slate-500 font-semibold mb-8 tracking-wide">{selectedItem.english}</p>
391
+
392
+ <div className="grid grid-cols-2 gap-3 mb-8">
393
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm cursor-pointer hover:shadow-md transition-shadow" onClick={() => setSelectedItem(selectedItem.lord)}>
394
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1 flex justify-between">അധിപൻ (Lord) <span style={{color: selectedItem.lord.color}}>{selectedItem.lord.icon}</span></p>
395
+ <p className="font-bold text-slate-800 text-sm">{selectedItem.lord.eng} ({selectedItem.lord.mal})</p>
396
+ </div>
397
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm">
398
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">തത്ത്വം (Element)</p>
399
+ <p className="font-bold text-slate-800 text-sm">{selectedItem.element}</p>
400
+ </div>
401
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm col-span-2 flex justify-between items-center">
402
+ <div>
403
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">വ്യാപ്തി (Span)</p>
404
+ <p className="font-bold text-slate-800 text-sm">30° 00'</p>
405
+ </div>
406
+ <div className="text-xs font-medium text-slate-400">9 Padams</div>
407
+ </div>
408
+ </div>
409
+
410
+ <div className="flex items-center gap-3 mb-5">
411
+ <Sparkles className="w-5 h-5 text-amber-500" />
412
+ <h3 className="text-lg font-bold text-slate-800">Constituent Stars</h3>
413
+ </div>
414
+
415
+ <ul className="space-y-3">
416
+ {innerNaks.map((info, idx) => (
417
+ <li key={idx} className="group flex justify-between items-center p-4 bg-white rounded-2xl border border-slate-100 hover:border-amber-300 hover:shadow-md transition-all cursor-pointer" onClick={(e) => { e.stopPropagation(); setSelectedItem(info.nak); }}>
418
+ <div>
419
+ <span className="font-bold text-slate-800 block text-lg group-hover:text-amber-600 transition-colors">{info.nak.malayalam}</span>
420
+ <span className="text-xs font-medium text-slate-500">{info.nak.english}</span>
421
+ </div>
422
+ <div className="text-right flex flex-col items-end">
423
+ <span className="bg-amber-50 text-amber-700 px-3 py-1 rounded-lg text-[11px] font-bold block mb-1.5 shadow-sm border border-amber-100">
424
+ {info.proportionText}
425
+ </span>
426
+ <span className="text-[10px] font-bold text-slate-400 uppercase tracking-wider flex gap-1">
427
+ {Array.from({length: info.padams}).map((_, i) => (
428
+ <div key={i} className="w-1.5 h-1.5 bg-amber-400 rounded-full" />
429
+ ))}
430
+ <span className="ml-1">{info.padams} Padam{info.padams > 1 ? 's' : ''}</span>
431
+ </span>
432
+ </div>
433
+ </li>
434
+ ))}
435
+ </ul>
436
+ </div>
437
+ );
438
+ }
439
+
440
+ if (selectedItem.type === 'nakshatra') {
441
+ const parentRasis = rasis.map(rasi => getOverlapInfo(rasi, selectedItem)).filter(Boolean);
442
+ return (
443
+ <div className="flex flex-col h-full bg-white/90 backdrop-blur-xl p-8 rounded-3xl shadow-xl border border-white overflow-y-auto animate-in slide-in-from-right-4 duration-300" onClick={(e) => e.stopPropagation()}>
444
+ <div className="inline-flex items-center self-start px-4 py-1.5 bg-indigo-100 text-indigo-800 text-[10px] font-bold uppercase tracking-widest rounded-full mb-5 shadow-sm border border-indigo-200">
445
+ നക്ഷത്രം • Nakshatra
446
+ </div>
447
+ <h2 className="text-5xl font-black text-slate-800 mb-1 tracking-tight">{selectedItem.malayalam}</h2>
448
+ <p className="text-xl text-slate-500 font-semibold mb-8 tracking-wide">{selectedItem.english}</p>
449
+
450
+ <div className="grid grid-cols-2 gap-3 mb-8">
451
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm cursor-pointer hover:shadow-md transition-shadow" onClick={() => setSelectedItem(selectedItem.lord)}>
452
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1 flex justify-between">അധിപൻ (Lord) <span style={{color: selectedItem.lord.color}}>{selectedItem.lord.icon}</span></p>
453
+ <p className="font-bold text-slate-800 text-sm">{selectedItem.lord.eng} ({selectedItem.lord.mal})</p>
454
+ </div>
455
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm">
456
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">പാദങ്ങൾ</p>
457
+ <p className="font-bold text-slate-800 text-sm">4 Padams</p>
458
+ </div>
459
+ <div className="bg-gradient-to-br from-slate-50 to-slate-100 p-4 rounded-2xl border border-slate-200/60 shadow-sm col-span-2 flex justify-between items-center">
460
+ <div>
461
+ <p className="text-[10px] text-slate-400 font-bold uppercase tracking-widest mb-1">വ്യാപ്തി (Span)</p>
462
+ <p className="font-bold text-slate-800 text-sm">13° 20'</p>
463
+ </div>
464
+ <div className="text-xs font-medium text-slate-400">13.333 Degrees</div>
465
+ </div>
466
+ </div>
467
+
468
+ <div className="flex items-center gap-3 mb-5">
469
+ <Compass className="w-5 h-5 text-indigo-500" />
470
+ <h3 className="text-lg font-bold text-slate-800">Residing Zodiacs</h3>
471
+ </div>
472
+
473
+ <ul className="space-y-3">
474
+ {parentRasis.map((info, idx) => (
475
+ <li key={idx} className="group flex justify-between items-center p-4 bg-white rounded-2xl border border-slate-100 hover:border-indigo-300 hover:shadow-md transition-all cursor-pointer" onClick={(e) => { e.stopPropagation(); setSelectedItem(info.rasi); }}>
476
+ <div>
477
+ <span className="font-bold text-slate-800 block text-lg group-hover:text-indigo-600 transition-colors">{info.rasi.malayalam}</span>
478
+ <span className="text-xs font-medium text-slate-500">{info.rasi.english}</span>
479
+ </div>
480
+ <div className="text-right flex flex-col items-end">
481
+ <span className="bg-indigo-50 text-indigo-700 px-3 py-1 rounded-lg text-[11px] font-bold block mb-1.5 shadow-sm border border-indigo-100">
482
+ {info.proportionText}
483
+ </span>
484
+ <span className="text-[10px] font-bold text-slate-400 uppercase tracking-wider flex gap-1">
485
+ {Array.from({length: info.padams}).map((_, i) => (
486
+ <div key={i} className="w-1.5 h-1.5 bg-indigo-400 rounded-full" />
487
+ ))}
488
+ <span className="ml-1">{info.padams} Padam{info.padams > 1 ? 's' : ''}</span>
489
+ </span>
490
+ </div>
491
+ </li>
492
+ ))}
493
+ </ul>
494
+ </div>
495
+ );
496
+ }
497
+ };
498
+
499
+ return (
500
+ <div
501
+ className="min-h-screen bg-slate-100 text-slate-800 font-sans p-4 md:p-8 flex flex-col xl:flex-row gap-8 selection:bg-indigo-100 selection:text-indigo-900"
502
+ onClick={() => setSelectedItem(null)}
503
+ >
504
+ {/* Left Side: Chart UI */}
505
+ <div
506
+ className="w-full xl:w-2/3 flex flex-col items-center justify-center bg-white/60 backdrop-blur-3xl p-6 md:p-10 rounded-[2.5rem] shadow-2xl shadow-slate-200/50 border border-white"
507
+ onClick={(e) => e.stopPropagation()}
508
+ >
509
+ <div className="mb-8 text-center max-w-lg">
510
+ <h1 className="text-3xl md:text-5xl font-black text-slate-800 mb-4 tracking-tight">കേരള ജ്യോതിഷ ചക്രം</h1>
511
+ <p className="text-slate-600 font-bold flex items-center justify-center gap-2 bg-white/80 py-2.5 px-5 rounded-full inline-flex border border-slate-200/60 shadow-sm">
512
+ <Info className="w-5 h-5 text-indigo-600" />
513
+ <span className="text-sm">Interactive Navagraha, Nakshatra & Rasi Wheel</span>
514
+ </p>
515
+ </div>
516
+ <div className="w-full flex justify-center items-center cursor-crosshair" onClick={() => setSelectedItem(null)}>
517
+ {renderChart()}
518
+ </div>
519
+ </div>
520
+
521
+ {/* Right Side: Details Panel */}
522
+ <div className="w-full xl:w-1/3 flex flex-col h-[650px] xl:h-auto z-10 relative">
523
+ {renderDetails()}
524
+ </div>
525
+ </div>
526
+ );
527
+ }