# Gradient Utilities Reference Guide

Complete reference for all gradient utility classes in your Tailwind CSS v4 setup.

---

## 📝 Text Gradient Utilities

### `text-gradient` or `text-gradient-primary`

**Where to apply:** Headings, titles, labels, text elements, button text

**Examples:**

```tsx
<h1 className="text-gradient">Main Heading</h1>
<p className="text-gradient">Gradient text</p>
<span className="text-gradient">Label</span>
<button className="text-gradient">Button text</button>
```

### `text-gradient-accent`

**Where to apply:** Secondary headings, accent text

**Examples:**

```tsx
<h2 className="text-gradient-accent">Subheading</h2>
<p className="text-gradient-accent">Accent text</p>
```

---

## 🎨 Background Gradient Utilities

### `bg-primary-gradient`

**Where to apply:** Buttons, cards, sections, hero banners, sidebars, containers

**Examples:**

```tsx
<button className="bg-primary-gradient text-white">Button</button>
<div className="bg-primary-gradient text-white p-6">Card</div>
<section className="bg-primary-gradient text-white py-20">Hero section</section>
<aside className="bg-primary-gradient">Sidebar</aside>
<header className="bg-primary-gradient">Header</header>
```

### `bg-accent-gradient`

**Where to apply:** Secondary buttons, alternate sections, decorative elements

**Examples:**

```tsx
<button className="bg-accent-gradient text-white">Secondary button</button>
<div className="bg-accent-gradient text-white p-6">Feature card</div>
<div className="bg-accent-gradient">Banner</div>
```

### `bg-light-blue`

**Where to apply:** Subtle backgrounds, hover states, light sections

**Examples:**

```tsx
<div className="bg-light-blue p-6">Light section</div>
<div className="bg-light-blue hover:bg-primary-gradient">Hover card</div>
<input className="bg-light-blue" />
```

---

## 🎯 Solid Color Utilities (From Gradient Palette)

### `text-gradient-start`

**Color:** `#1A315F`  
**Where to apply:** Icons, text, borders

**Examples:**

```tsx
<Calendar className="text-gradient-start" />
<h3 className="text-gradient-start">Title</h3>
<p className="text-gradient-start">Text</p>
<div className="border-2 border-gradient-start">Bordered div</div>
```

### `text-gradient-end`

**Color:** `#25518C`  
**Where to apply:** Icons, text, borders

**Examples:**

```tsx
<Users className="text-gradient-end" />
<span className="text-gradient-end">Label</span>
<div className="border-2 border-gradient-end">Bordered div</div>
```

### `bg-gradient-start`

**Color:** `#1A315F`  
**Where to apply:** Solid backgrounds, badges, pills

**Examples:**

```tsx
<div className="bg-gradient-start text-white">Solid background</div>
<span className="bg-gradient-start text-white px-3 py-1 rounded-full">Badge</span>
<button className="bg-gradient-start text-white">Button</button>
```

### `bg-gradient-end`

**Color:** `#25518C`  
**Where to apply:** Solid backgrounds, badges, pills

**Examples:**

```tsx
<div className="bg-gradient-end text-white">Solid background</div>
<span className="bg-gradient-end text-white px-3 py-1 rounded-full">Badge</span>
<button className="bg-gradient-end text-white">Button</button>
```

---

## 🖱️ Hover State Utilities

### `hover-text-gradient`

**Where to apply:** Links, buttons, text that should show gradient on hover

**Examples:**

```tsx
<a className="hover-text-gradient">Link</a>
<button className="hover-text-gradient">Button</button>
<div className="hover-text-gradient cursor-pointer">Interactive text</div>
```

### `hover-bg-gradient`

**Where to apply:** Cards, buttons, containers that need gradient background on hover

**Examples:**

```tsx
<div className="hover-bg-gradient hover:text-white">Card</div>
<button className="hover-bg-gradient hover:text-white">Button</button>
<a className="hover-bg-gradient hover:text-white">Link card</a>
```

---

## 🔲 Border Gradient Utilities

### `border-gradient`

**Where to apply:** Cards, containers, dividers (requires border to be set first)

**Examples:**

```tsx
<div className="border border-gradient">Card</div>
<div className="border-2 border-gradient">Container</div>
```

### `border-gradient-primary`

**Where to apply:** Cards, inputs, containers (includes border styling)

**Examples:**

```tsx
<div className="border-gradient-primary p-6">Card with gradient border</div>
<input className="border-gradient-primary" />
```

---

## 📱 Common Use Cases by Component Type

### Buttons

```tsx
// Primary gradient button
<button className="bg-primary-gradient text-white px-6 py-3 rounded-lg">
  Click me
</button>

// Outline button with gradient text
<button className="border-2 border-gray-300 text-gradient px-6 py-3 rounded-lg">
  Click me
</button>

// Hover gradient button
<button className="bg-white border-2 border-gray-300 hover-bg-gradient hover:text-white px-6 py-3 rounded-lg">
  Hover me
</button>

// Solid color button
<button className="bg-gradient-start text-white px-6 py-3 rounded-lg">
  Click me
</button>

// Gradient text button
<button className="text-gradient font-semibold">
  Text Button
</button>
```

### Cards

```tsx
// Gradient background card
<div className="bg-primary-gradient text-white p-6 rounded-lg shadow-lg">
  <h3 className="text-xl font-bold mb-2">Card Title</h3>
  <p>Card content</p>
</div>

// Gradient border card
<div className="border-gradient-primary p-6 rounded-lg">
  <h3 className="text-gradient text-xl font-bold mb-2">Card Title</h3>
  <p className="text-gray-600">Card content</p>
</div>

// Hover gradient card
<div className="bg-white hover-bg-gradient hover:text-white p-6 rounded-lg transition-all">
  <h3 className="font-bold mb-2">Hover Card</h3>
  <p>Hover to see effect</p>
</div>

// Card with gradient heading
<div className="bg-white p-6 rounded-lg shadow-md">
  <h3 className="text-gradient text-xl font-bold mb-2">Title</h3>
  <p className="text-gray-600">Content here</p>
</div>
```

### Icons (Lucide React)

```tsx
// Solid gradient color (recommended)
<Calendar className="w-6 h-6 text-gradient-start" />
<Users className="w-6 h-6 text-gradient-end" />

// Icon on gradient background
<div className="bg-primary-gradient p-4 rounded-lg inline-block">
  <Star className="w-6 h-6 text-white" />
</div>

// Icon with solid gradient background
<div className="bg-gradient-start p-3 rounded-full inline-block">
  <Heart className="w-5 h-5 text-white" />
</div>

// SVG gradient (define gradient once in layout)
<svg width="0" height="0" className="absolute">
  <defs>
    <linearGradient id="iconGradient" x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" stopColor="#1A315F" />
      <stop offset="100%" stopColor="#25518C" />
    </linearGradient>
  </defs>
</svg>
<Star className="w-6 h-6" style={{ fill: 'url(#iconGradient)' }} />
```

### Headers & Titles

```tsx
// Main heading with gradient
<h1 className="text-gradient text-5xl font-bold">
  Main Title
</h1>

// Subheading with accent gradient
<h2 className="text-gradient-accent text-3xl font-semibold">
  Subtitle
</h2>

// Solid color heading
<h3 className="text-gradient-start text-2xl font-bold">
  Section Title
</h3>

// Gradient text with icon
<div className="flex items-center gap-3">
  <Sparkles className="text-gradient-start w-8 h-8" />
  <h2 className="text-gradient text-3xl font-bold">Featured</h2>
</div>
```

### Navigation/Sidebar

```tsx
// Sidebar container with gradient background
<aside className="bg-primary-gradient h-screen w-64">
  {/* Menu items */}
</aside>

// Active menu item
<button className="bg-white text-gradient px-4 py-3 rounded-lg w-full text-left">
  <Calendar className="inline-block text-gradient-start mr-3" />
  Dashboard
</button>

// Inactive menu item
<button className="text-white/80 hover:bg-white/10 px-4 py-3 rounded-lg w-full text-left">
  <Users className="inline-block mr-3" />
  Users
</button>

// Nav link with gradient on hover
<a className="text-gray-700 hover-text-gradient font-medium">
  Features
</a>
```

### Badges & Pills

```tsx
// Gradient background badge
<span className="bg-primary-gradient text-white px-3 py-1 rounded-full text-sm font-medium">
  New
</span>

// Solid color badge
<span className="bg-gradient-start text-white px-3 py-1 rounded-full text-sm">
  Badge
</span>

// Gradient text badge with border
<span className="text-gradient border-2 border-gray-300 px-3 py-1 rounded-full text-sm font-medium">
  Tag
</span>

// Light background badge
<span className="bg-light-blue text-gradient-start px-3 py-1 rounded-full text-sm">
  Label
</span>
```

### Forms

```tsx
// Submit button with gradient
<button type="submit" className="bg-primary-gradient text-white px-6 py-3 rounded-lg font-semibold w-full">
  Submit
</button>

// Input with light background
<input
  type="text"
  className="bg-light-blue border-0 px-4 py-3 rounded-lg w-full"
  placeholder="Enter text..."
/>

// Label with gradient color
<label className="text-gradient-start font-semibold mb-2 block">
  Name
</label>

// Input with gradient border
<input
  type="email"
  className="border-gradient-primary px-4 py-3 rounded-lg w-full"
/>

// Checkbox with gradient text
<label className="flex items-center gap-2">
  <input type="checkbox" />
  <span className="text-gradient-start">I agree to terms</span>
</label>
```

### Sections/Containers

```tsx
// Hero section with gradient background
<section className="bg-primary-gradient text-white py-20 px-4">
  <h1 className="text-5xl font-bold mb-4">Welcome</h1>
  <p className="text-xl">Subtitle here</p>
</section>

// Feature section with light background
<section className="bg-light-blue py-16 px-4">
  <h2 className="text-gradient text-3xl font-bold mb-8">Features</h2>
  {/* Content */}
</section>

// Section with gradient heading
<section className="py-16 px-4">
  <h2 className="text-gradient text-4xl font-bold text-center mb-12">
    Our Services
  </h2>
  {/* Content */}
</section>

// Container with gradient border
<div className="border-gradient-primary p-8 rounded-2xl">
  <h3 className="text-gradient text-2xl font-bold mb-4">Premium Content</h3>
  {/* Content */}
</div>
```

### Lists & Menu Items

```tsx
// Active list item with gradient
<li className="bg-white text-gradient p-3 rounded-lg font-semibold">
  Active Item
</li>

// Hover effect list item
<li className="hover-bg-gradient hover:text-white p-3 rounded-lg cursor-pointer transition-all">
  Hover Item
</li>

// Icon list item with gradient icon
<li className="flex items-center gap-3 p-2">
  <Check className="text-gradient-start w-5 h-5" />
  <span>Completed Task</span>
</li>

// Numbered list with gradient numbers
<li className="flex gap-4">
  <span className="text-gradient text-2xl font-bold">01</span>
  <div>
    <h4 className="font-semibold mb-1">Step One</h4>
    <p className="text-gray-600">Description here</p>
  </div>
</li>
```

### Tables

```tsx
// Table header with gradient background
<thead className="bg-primary-gradient text-white">
  <tr>
    <th className="px-4 py-3">Name</th>
    <th className="px-4 py-3">Status</th>
  </tr>
</thead>

// Table header with gradient text
<thead className="bg-gray-50">
  <tr>
    <th className="px-4 py-3 text-gradient-start font-semibold">Name</th>
    <th className="px-4 py-3 text-gradient-start font-semibold">Status</th>
  </tr>
</thead>

// Status badge in table
<td className="px-4 py-3">
  <span className="bg-gradient-start text-white px-3 py-1 rounded-full text-sm">
    Active
  </span>
</td>
```

### Modals/Dialogs

```tsx
// Modal header with gradient
<div className="bg-primary-gradient text-white px-6 py-4 rounded-t-lg">
  <h3 className="text-xl font-bold">Modal Title</h3>
</div>

// Modal with gradient border
<div className="border-gradient-primary p-6 rounded-lg">
  <h3 className="text-gradient text-2xl font-bold mb-4">Dialog</h3>
  {/* Content */}
</div>

// Modal close button
<button className="text-gradient-start hover:text-gradient-end">
  <X className="w-6 h-6" />
</button>
```

### Alerts/Notifications

```tsx
// Success alert with gradient
<div className="bg-primary-gradient text-white p-4 rounded-lg flex items-center gap-3">
  <CheckCircle className="w-6 h-6" />
  <p>Success message</p>
</div>

// Alert with gradient border
<div className="border-gradient-primary p-4 rounded-lg flex items-center gap-3">
  <Info className="text-gradient-start w-6 h-6" />
  <p>Information message</p>
</div>

// Alert with gradient icon
<div className="bg-light-blue p-4 rounded-lg flex items-center gap-3">
  <AlertTriangle className="text-gradient-start w-6 h-6" />
  <p>Warning message</p>
</div>
```

---

## 💡 Best Practices

### ✅ DO

- **Use `text-gradient` for main headings and important text** - Creates visual hierarchy
- **Use `text-gradient-start` for icons** - Most common and looks professional
- **Use `bg-primary-gradient` for primary actions** - Buttons, CTAs, hero sections
- **Use `bg-light-blue` for subtle backgrounds** - Forms, sections, hover states
- **Combine utilities for better effects** - `bg-primary-gradient text-white rounded-lg p-4 shadow-lg`
- **Use solid colors for better performance** - `text-gradient-start` instead of full gradients on small elements
- **Maintain consistency** - Use same gradient direction throughout your app

### ❌ DON'T

- **Don't use text gradients on small text (< 14px)** - Hard to read, poor accessibility
- **Don't overuse gradients** - Use strategically for emphasis, not everywhere
- **Don't combine `text-gradient` with `bg-primary-gradient`** - Poor contrast and readability
- **Don't use gradient backgrounds on form inputs** - Use `bg-light-blue` for better UX
- **Don't use gradients on body text** - Reserve for headings and important elements
- **Don't mix too many gradient directions** - Stick to your primary (vertical) and accent (horizontal)
- **Don't forget hover states** - Gradients should respond to user interaction

---

## 🎨 Quick Combination Patterns

### Premium Feature Card

```tsx
<div className="bg-white border-gradient-primary p-6 rounded-xl shadow-md hover:shadow-xl transition-shadow">
  <div className="bg-primary-gradient p-4 rounded-lg inline-block mb-4">
    <Star className="text-white w-8 h-8" />
  </div>
  <h3 className="text-gradient text-xl font-bold mb-2">Premium Feature</h3>
  <p className="text-gray-600 mb-4">Description text goes here</p>
  <button className="text-gradient-start font-semibold">Learn More →</button>
</div>
```

### Call-to-Action Button

```tsx
<button className="bg-primary-gradient text-white px-8 py-4 rounded-lg font-semibold hover:opacity-90 transition-opacity shadow-lg">
  Get Started
</button>
```

### Stat Card

```tsx
<div className="bg-primary-gradient text-white p-6 rounded-xl shadow-lg">
  <Calendar className="w-8 h-8 mb-3 opacity-90" />
  <h3 className="text-lg mb-2 opacity-90">Total Appointments</h3>
  <p className="text-4xl font-bold">127</p>
  <p className="text-sm mt-2 opacity-75">+12% from last month</p>
</div>
```

### Feature List Item

```tsx
<div className="border-2 border-gray-200 p-6 rounded-xl hover:shadow-lg transition-shadow">
  <Sparkles className="w-10 h-10 text-gradient-start mb-4" />
  <h3 className="text-gradient text-xl font-semibold mb-2">Feature Title</h3>
  <p className="text-gray-600">Feature description explaining the benefit to users</p>
</div>
```

### Profile Card

```tsx
<div className="bg-white rounded-xl shadow-lg overflow-hidden">
  <div className="bg-primary-gradient h-32"></div>
  <div className="px-6 pb-6 -mt-16">
    <div className="bg-white w-24 h-24 rounded-full border-4 border-white shadow-lg mb-4">{/* Avatar */}</div>
    <h3 className="text-gradient text-2xl font-bold mb-1">John Doe</h3>
    <p className="text-gray-600 mb-4">Product Designer</p>
    <button className="bg-gradient-start text-white w-full py-3 rounded-lg font-semibold">View Profile</button>
  </div>
</div>
```

### Hero Section

```tsx
<section className="bg-primary-gradient text-white py-20 px-4">
  <div className="max-w-4xl mx-auto text-center">
    <h1 className="text-5xl md:text-6xl font-bold mb-6">Welcome to AIVLY</h1>
    <p className="text-xl mb-8 opacity-90">Transform your business with AI-powered solutions</p>
    <button className="bg-white text-gradient px-8 py-4 rounded-lg font-semibold hover:shadow-xl transition-shadow">Get Started</button>
  </div>
</section>
```

### Dashboard Widget

```tsx
<div className="bg-white p-6 rounded-xl shadow-md">
  <div className="flex items-center justify-between mb-4">
    <h3 className="text-gradient font-semibold">Revenue</h3>
    <TrendingUp className="text-gradient-start w-5 h-5" />
  </div>
  <p className="text-3xl font-bold text-gradient-start mb-2">$45,230</p>
  <p className="text-sm text-gray-600">+8% from last month</p>
</div>
```

### Pricing Card

```tsx
<div className="border-gradient-primary p-8 rounded-2xl text-center">
  <h3 className="text-gradient text-2xl font-bold mb-2">Pro Plan</h3>
  <div className="my-6">
    <span className="text-5xl font-bold text-gradient-start">$49</span>
    <span className="text-gray-600">/month</span>
  </div>
  <ul className="space-y-3 mb-6 text-left">
    <li className="flex items-center gap-2">
      <Check className="text-gradient-start w-5 h-5" />
      <span>Unlimited projects</span>
    </li>
    <li className="flex items-center gap-2">
      <Check className="text-gradient-start w-5 h-5" />
      <span>Priority support</span>
    </li>
  </ul>
  <button className="bg-primary-gradient text-white w-full py-3 rounded-lg font-semibold">Choose Plan</button>
</div>
```

---

## 📊 Color Reference

| Utility               | Color Value                                         | Usage               |
| --------------------- | --------------------------------------------------- | ------------------- |
| `text-gradient-start` | `#1A315F`                                           | Primary dark blue   |
| `text-gradient-end`   | `#25518C`                                           | Primary light blue  |
| `bg-primary-gradient` | `linear-gradient(180deg, #1A315F 0%, #25518C 100%)` | Vertical gradient   |
| `bg-accent-gradient`  | `linear-gradient(90deg, #25518C 0%, #1A315F 100%)`  | Horizontal gradient |
| `bg-light-blue`       | `rgba(38, 84, 145, 0.15)`                           | Light background    |

---

## 🔍 Accessibility Notes

- ⚠️ Ensure sufficient contrast when using gradients with text
- ⚠️ Avoid gradient text smaller than 16px for readability
- ⚠️ Always test gradient combinations for color-blind users
- ⚠️ Use solid colors (`text-gradient-start`) for critical UI elements
- ✅ Gradient backgrounds work well with white text
- ✅ Test hover states for clear visual feedback

---

**Last Updated:** November 2024  
**Tailwind CSS Version:** v4.x
