/**
 * Components - NGO Website
 * Reusable UI components
 * Version: 1.0
 */

/* ========================================
   BUTTON SYSTEM
   ======================================== */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: var(--leading-normal);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.button:focus {
    outline: none;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button */
.button-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    text-decoration: none;
}

.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

/* Secondary Button */
.button-secondary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.button-secondary:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* Tertiary Button */
.button-tertiary {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.button-tertiary:hover {
    background: var(--secondary-dark);
    border-color: var(--secondary-dark);
    text-decoration: none;
}

/* Outline Button */
.button-outline {
    background: transparent;
    color: var(--gray-800);
    border-color: var(--gray-400);
}

.button-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-500);
    text-decoration: none;
}

/* Ghost Button */
.button-ghost {
    background: transparent;
    color: var(--primary);
    border-color: transparent;
}

.button-ghost:hover {
    background: var(--primary-alpha-10);
    text-decoration: none;
}

/* Danger Button */
.button-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.button-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    text-decoration: none;
}

/* Button Sizes */
.button-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.button-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.button-xl {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-xl);
}

/* Full Width Button */
.button-block {
    display: flex;
    width: 100%;
}

/* Button with Icon */
.button i {
    font-size: 1.2em;
}

/* Button Loading State */
.button.loading {
    color: transparent;
    pointer-events: none;
}

.button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    color: white;
}

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

/* Button Group */
.button-group {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.button-group-vertical {
    flex-direction: column;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }

    .button-group .button {
        width: 100%;
    }
}

/* ========================================
   CARD COMPONENTS
   ======================================== */

.card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

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

/* Card Image */
.card-image {
    position: relative;
    width: 100%;
    padding-top: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background: var(--gray-200);
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

/* Card Badge */
.card-badge {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--success);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-badge.badge-warning {
    background: var(--warning);
    color: var(--gray-900);
}

.card-badge.badge-danger {
    background: var(--danger);
}

/* Card Content */
.card-content {
    padding: var(--space-6);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin-bottom: var(--space-3);
    line-height: var(--leading-tight);
}

.card-title a {
    color: inherit;
    text-decoration: none;
}

.card-title a:hover {
    color: var(--primary);
}

.card-text {
    color: var(--gray-700);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-5);
    flex: 1;
}

/* Card Meta */
.card-meta {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-4);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-meta-item i {
    color: var(--primary);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: auto;
}

/* Progress Bar in Card */
.progress-wrapper {
    margin-bottom: var(--space-5);
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--gray-700);
}

.progress-stats strong {
    color: var(--gray-900);
    font-weight: var(--font-bold);
}

/* Card Horizontal */
.card-horizontal {
    flex-direction: row;
}

.card-horizontal .card-image {
    width: 40%;
    padding-top: 0;
    min-height: 250px;
}

.card-horizontal .card-image img {
    position: static;
}

@media (max-width: 768px) {
    .card-horizontal {
        flex-direction: column;
    }

    .card-horizontal .card-image {
        width: 100%;
        padding-top: 66.67%;
    }

    .card-horizontal .card-image img {
        position: absolute;
    }
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-8);
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero-section {
    min-height: 600px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    align-items: center;
    padding: var(--space-20) 0;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--white) 100%);
    position: relative;
    overflow: hidden;
}

/* Hero Background Pattern */
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-alpha-10) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--primary-alpha-10);
    border-radius: var(--radius-full);
}

.hero-title {
    font-size: var(--text-6xl);
    font-weight: var(--font-extrabold);
    line-height: var(--leading-tight);
    color: var(--gray-900);
    margin-bottom: var(--space-6);
}

.hero-description {
    font-size: var(--text-xl);
    color: var(--gray-700);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-8);
}

.hero-cta {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-12);
}

/* Hero Trust Indicators */
.hero-trust {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
}

.trust-item {
    text-align: center;
}

.trust-item strong {
    display: block;
    font-size: var(--text-4xl);
    color: var(--primary);
    font-weight: var(--font-extrabold);
    margin-bottom: var(--space-2);
}

.trust-item span {
    color: var(--gray-600);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

/* Hero Media */
.hero-media {
    position: relative;
    z-index: 1;
}

.hero-media img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
}

/* Responsive Hero */
@media (max-width: 768px) {
    .hero-section {
        grid-template-columns: 1fr;
        gap: var(--space-10);
        padding: var(--space-12) 0;
        text-align: center;
    }

    .hero-title {
        font-size: var(--text-4xl);
    }

    .hero-description {
        font-size: var(--text-lg);
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-trust {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
}

/* ========================================
   SECTION LAYOUTS
   ======================================== */

.section {
    padding: var(--space-20) 0;
}

.section-sm {
    padding: var(--space-12) 0;
}

.section-lg {
    padding: var(--space-32) 0;
}

/* Section Header */
.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-16);
}

.section-subtitle {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--primary-alpha-10);
    border-radius: var(--radius-full);
}

.section-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin-bottom: var(--space-4);
    line-height: var(--leading-tight);
}

.section-description {
    font-size: var(--text-lg);
    color: var(--gray-700);
    line-height: var(--leading-relaxed);
}

/* Section with Alternate Background */
.section-alt {
    background: var(--bg-secondary);
}

/* Dark Section */
.section-dark {
    background: var(--bg-dark);
    color: white;
}

.section-dark .section-title {
    color: white;
}

.section-dark .section-description {
    color: var(--gray-300);
}

.section-dark .section-subtitle {
    background: var(--primary-alpha-20);
    color: var(--primary-light);
}

/* Section with Pattern */
.section-pattern {
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%234CAF50" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    align-items: center;
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .section-header {
        margin-bottom: var(--space-10);
    }
}

/* ========================================
   FEATURE BOXES
   ======================================== */

.feature-box {
    text-align: center;
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    background: white;
    transition: all var(--transition-base);
}

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

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-alpha-10) 0%, var(--primary-alpha-20) 100%);
    border-radius: var(--radius-full);
    font-size: 40px;
    color: var(--primary);
}

.feature-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.feature-text {
    color: var(--gray-700);
    line-height: var(--leading-relaxed);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-8);
}

/* ========================================
   STAT BOXES
   ======================================== */

.stat-box {
    text-align: center;
    padding: var(--space-8);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: var(--text-6xl);
    font-weight: var(--font-extrabold);
    color: var(--primary);
    line-height: 1;
    margin-bottom: var(--space-3);
}

.stat-label {
    font-size: var(--text-base);
    color: var(--gray-700);
    font-weight: var(--font-semibold);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-6);
}

/* ========================================
   TESTIMONIAL
   ======================================== */

.testimonial-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-md);
    position: relative;
}

.quote-icon {
    font-size: 64px;
    color: var(--primary);
    opacity: 0.2;
    margin-bottom: var(--space-5);
    line-height: 1;
}

.testimonial-text {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: var(--gray-700);
    margin-bottom: var(--space-8);
    font-style: italic;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.author-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.author-name {
    font-weight: var(--font-bold);
    color: var(--gray-900);
    margin-bottom: var(--space-1);
}

.author-role {
    font-size: var(--text-sm);
    color: var(--gray-600);
}

/* ========================================
   CTA SECTION
   ======================================== */

.cta-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--space-20) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.cta-content {
    position: relative;
    z-index: 1;
}

.cta-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    color: white;
    margin-bottom: var(--space-4);
}

.cta-description {
    font-size: var(--text-xl);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.cta-buttons .button-secondary {
    background: white;
    color: var(--primary);
    border-color: white;
}

.cta-buttons .button-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-100);
}

@media (max-width: 768px) {
    .cta-title {
        font-size: var(--text-3xl);
    }

    .cta-description {
        font-size: var(--text-lg);
    }

    .cta-buttons {
        flex-direction: column;
    }
}

/* ========================================
   STICKY DONATE BUTTON
   ======================================== */

.sticky-donate {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-fixed);
    opacity: 0;
    transform: translateY(100px);
    transition: all var(--transition-base);
}

.sticky-donate.visible {
    opacity: 1;
    transform: translateY(0);
}

.sticky-donate .button {
    box-shadow: var(--shadow-2xl);
    animation: pulse-shadow 2s infinite;
}

@keyframes pulse-shadow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 8px 30px rgba(76, 175, 80, 0.6);
    }
}

@media (max-width: 768px) {
    .sticky-donate {
        bottom: 0;
        left: 0;
        right: 0;
        padding: var(--space-4);
        background: white;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }

    .sticky-donate .button {
        width: 100%;
        animation: none;
    }
}
