:root {
    --brand-primary: #6659ff;
    --brand-secondary: #ff75b5;
    --brand-dark: #111827;
    --brand-muted: #6b7280;
    --brand-bg: #f5f6fb;
    --brand-surface: #ffffff;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-lg: 0 25px 65px rgba(15, 23, 42, 0.12);
    --shadow-md: 0 12px 35px rgba(15, 23, 42, 0.08);
    --gradient-hero: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    font-size: 16px;
}

[data-theme="dark"] {
    --brand-primary: #8b7fff;
    --brand-secondary: #ff8cc8;
    --brand-dark: #e5e7eb;
    --brand-muted: #9ca3af;
    --brand-bg: #0f172a;
    --brand-surface: #1e293b;
    --shadow-lg: 0 25px 65px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 12px 35px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .navbar-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .me-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

[dir="rtl"] .ms-1,
[dir="rtl"] .ms-2,
[dir="rtl"] .ms-3 {
    margin-left: 0 !important;
    margin-right: 0.25rem !important;
}

[dir="rtl"] .me-1,
[dir="rtl"] .me-2,
[dir="rtl"] .me-3 {
    margin-right: 0 !important;
    margin-left: 0.25rem !important;
}

html, body {
    min-height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-dark);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] {
    background: var(--brand-bg);
    color: var(--brand-dark);
}

body[data-theme="dark"] .navbar-blur {
    background-color: rgba(30, 41, 59, 0.85) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select {
    background-color: var(--brand-surface);
    color: var(--brand-dark);
    border-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .text-muted {
    color: var(--brand-muted) !important;
}

body[data-theme="dark"] .bg-light {
    background-color: var(--brand-surface) !important;
}

body[data-theme="dark"] .bg-white {
    background-color: var(--brand-surface) !important;
}

body[data-theme="dark"] .card {
    background-color: var(--brand-surface) !important;
    color: var(--brand-dark);
    border-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .card-body {
    background-color: var(--brand-surface) !important;
    color: var(--brand-dark);
}

body[data-theme="dark"] .bg-light-subtle {
    background-color: rgba(30, 41, 59, 0.5) !important;
    color: var(--brand-dark) !important;
}

body[data-theme="dark"] .text-dark {
    color: var(--brand-dark) !important;
}

body[data-theme="dark"] .border {
    border-color: rgba(148, 163, 184, 0.2) !important;
}

body[data-theme="dark"] .shadow-sm,
body[data-theme="dark"] .shadow,
body[data-theme="dark"] .shadow-lg {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

body[data-theme="dark"] .modal-content {
    background-color: var(--brand-surface);
    color: var(--brand-dark);
    border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .modal-header {
    border-bottom-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .modal-footer {
    border-top-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .table {
    color: var(--brand-dark);
}

body[data-theme="dark"] .list-group-item {
    background-color: var(--brand-surface);
    color: var(--brand-dark);
    border-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .input-group-text {
    background-color: var(--brand-surface);
    color: var(--brand-dark);
    border-color: rgba(148, 163, 184, 0.2);
}

/* Ensure all containers use dark mode properly */
body[data-theme="dark"] .container,
body[data-theme="dark"] .container-fluid {
    background-color: transparent;
}

body[data-theme="dark"] .row {
    background-color: transparent;
}

body[data-theme="dark"] .col,
body[data-theme="dark"] [class*="col-"] {
    background-color: transparent;
}

/* Fix for Bootstrap utility classes */
body[data-theme="dark"] .bg-body {
    background-color: var(--brand-bg) !important;
}

body[data-theme="dark"] .bg-body-tertiary {
    background-color: var(--brand-surface) !important;
}

body[data-theme="dark"] code {
    background-color: rgba(139, 127, 255, 0.15) !important;
    color: var(--brand-primary) !important;
}

body[data-theme="dark"] pre {
    background-color: var(--brand-surface) !important;
    color: var(--brand-dark) !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
}

/* Dark mode for buttons */
body[data-theme="dark"] .btn-outline-primary,
body[data-theme="dark"] .btn-outline-secondary,
body[data-theme="dark"] .btn-outline-success,
body[data-theme="dark"] .btn-outline-danger,
body[data-theme="dark"] .btn-outline-warning,
body[data-theme="dark"] .btn-outline-info {
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--brand-dark);
}

body[data-theme="dark"] .btn-outline-primary:hover,
body[data-theme="dark"] .btn-outline-secondary:hover,
body[data-theme="dark"] .btn-outline-success:hover,
body[data-theme="dark"] .btn-outline-danger:hover,
body[data-theme="dark"] .btn-outline-warning:hover,
body[data-theme="dark"] .btn-outline-info:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

body[data-theme="dark"] .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

body[data-theme="dark"] .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* Navbar toggler icon */
body[data-theme="dark"] .navbar-toggler {
    border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28229, 231, 235, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Navbar links */
body[data-theme="dark"] .navbar-nav .nav-link {
    color: var(--brand-dark);
}

body[data-theme="dark"] .navbar-nav .nav-link:hover,
body[data-theme="dark"] .navbar-nav .nav-link.active {
    color: var(--brand-primary);
}

/* Badge colors */
body[data-theme="dark"] .badge.bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
}

body[data-theme="dark"] .badge.bg-primary-subtle {
    background-color: rgba(102, 89, 255, 0.2) !important;
    color: var(--brand-primary) !important;
}

body[data-theme="dark"] .badge.bg-info-subtle {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
}

body[data-theme="dark"] .badge.bg-warning-subtle {
    background-color: rgba(234, 179, 8, 0.2) !important;
    color: #fbbf24 !important;
}

/* Links */
body[data-theme="dark"] a {
    color: var(--brand-primary);
}

body[data-theme="dark"] a:hover {
    color: var(--brand-secondary);
}

/* Form labels */
body[data-theme="dark"] .form-label {
    color: var(--brand-dark);
}

/* Border colors */
body[data-theme="dark"] .border-top,
body[data-theme="dark"] .border-bottom,
body[data-theme="dark"] .border-start,
body[data-theme="dark"] .border-end {
    border-color: rgba(148, 163, 184, 0.2) !important;
}

body[data-theme="dark"] .alert {
    background-color: var(--brand-surface);
    border-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .footer {
    background: #0a0e1a;
    color: rgba(226, 232, 240, 0.85);
}

body[data-theme="dark"] code {
    background: rgba(139, 127, 255, 0.15);
    color: var(--brand-primary);
}

body[data-theme="dark"] .greeting-card {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.25);
}

.app-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.celebration-effects {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.65;
}
.navbar-blur,
.app-shell main,
.footer {
    position: relative;
    z-index: 1;
}
.celebration-effects .particle {
    position: absolute;
    bottom: -10%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 2vw, 2.6rem);
    animation: riseParticle linear forwards;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.45));
    transform-origin: center;
    will-change: transform, opacity;
}
.celebration-effects .particle[data-type="heart"] {
    color: #ff6fa9;
}
.celebration-effects .particle[data-type="spark"] {
    color: #ffd166;
    font-size: clamp(1rem, 1.8vw, 2.2rem);
}
.celebration-effects .particle[data-type="firework"] {
    color: #6ee7ff;
    font-size: clamp(1.6rem, 2.4vw, 3rem);
    filter: drop-shadow(0 0 18px rgba(110, 231, 255, 0.6));
}
.celebration-effects .particle[data-type="celebrate"] {
    color: #f97316;
}
@keyframes riseParticle {
    0% {
        transform: translateY(0) scale(0.85) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    60% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(-115vh) scale(1.2) rotate(20deg);
        opacity: 0;
    }
}
.navbar-blur {
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    z-index: 1030;
    position: sticky;
    top: 0;
}

body {
    padding-top: 0;
}

.btn-gradient {
    background: var(--gradient-hero);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.8rem;
    box-shadow: 0 16px 30px rgba(102, 89, 255, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-gradient:hover,
.btn-gradient:focus {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(102, 89, 255, 0.3);
}

.hero {
    background: var(--gradient-hero);
    border-radius: 32px;
    padding: 4.5rem clamp(1.5rem, 5vw, 4rem);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero::after {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.4), transparent 55%),
                radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.35), transparent 65%);
    opacity: 0.85;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.18);
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.feature-card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--brand-surface);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
}

.template-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--brand-surface);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.template-card.selected {
    border-color: var(--brand-primary);
    transform: translateY(-3px);
    box-shadow: 0 20px 45px rgba(102, 89, 255, 0.25);
}

.template-card img {
    width: 100%;
    object-fit: cover;
}

.gradient-preview {
    border-radius: var(--radius-md);
    padding: 1.2rem;
    font-weight: 600;
    color: rgba(17, 24, 39, 0.85);
    background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12) 10px, transparent 10px, transparent 20px);
}

.event-card {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--brand-surface);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.12);
}

.event-card img {
    height: 220px;
    object-fit: cover;
}

.badge-soft {
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-soft[data-variant="birthday"] {
    background: rgba(255, 237, 213, 0.75);
    color: #c2410c;
}

.badge-soft[data-variant="anniversary"] {
    background: rgba(254, 205, 211, 0.75);
    color: #be123c;
}

.badge-soft[data-variant="wedding"] {
    background: rgba(224, 231, 255, 0.75);
    color: #3730a3;
}

.badge-soft[data-variant="graduation"] {
    background: rgba(220, 252, 231, 0.75);
    color: #15803d;
}

.badge-soft[data-variant="custom"] {
    background: rgba(206, 212, 218, 0.75);
    color: #495057;
}

.form-floating>label {
    color: var(--brand-muted);
}

.form-control, .form-select {
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(102, 89, 255, 0.65);
    box-shadow: 0 0 0 4px rgba(102, 89, 255, 0.15);
}

.greeting-card {
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 1.5rem;
    background: var(--brand-surface);
    backdrop-filter: blur(8px);
}

.footer {
    background: #0f172a;
    color: rgba(226, 232, 240, 0.85);
    padding: 2rem 0;
}

/* Access page styles */
.access-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(102, 89, 255, 0.1), rgba(255, 117, 181, 0.1));
    border-radius: 50%;
    margin: 0 auto;
}

.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .hero {
        border-radius: 24px;
        padding: 3.5rem 1.5rem;
    }

    .event-card img {
        height: 200px;
    }
    
    .access-icon-wrapper {
        width: 80px;
        height: 80px;
    }
    
    .access-icon-wrapper i {
        font-size: 2rem !important;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Smooth animations */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

/* Better form styling */
.form-control-lg {
    font-size: 1.1rem;
    padding: 0.875rem 1.25rem;
    border-radius: 16px;
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(102, 89, 255, 0.15);
    outline: none;
}

/* Enhanced button styles */
.btn {
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Better spacing */
section {
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    section {
        margin-bottom: 4rem;
    }
}

/* Improved code blocks */
code {
    background: rgba(102, 89, 255, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--brand-primary);
    word-break: break-all;
}

/* Toast notification styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
}

/* Enhanced greeting cards */
.greeting-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.greeting-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

/* Better image handling */
img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

/* Improved badges */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Theme toggle button */
.theme-toggle {
    border: 1px solid var(--brand-muted);
    background: var(--brand-surface);
    color: var(--brand-dark);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

body[data-theme="dark"] .theme-toggle {
    background: var(--brand-surface);
    border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .theme-toggle:hover {
    background: var(--brand-primary);
}

/* Language dropdown */
.dropdown-menu {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .dropdown-menu {
    background-color: var(--brand-surface);
    border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .dropdown-item {
    color: var(--brand-dark);
}

body[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(102, 89, 255, 0.1);
    color: var(--brand-primary);
}

body[data-theme="dark"] .dropdown-item.active {
    background-color: var(--brand-primary);
    color: white;
}

/* Accessibility Widget */
.accessibility-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

[dir="rtl"] .accessibility-widget {
    right: auto;
    left: 20px;
}

.accessibility-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.accessibility-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    background: var(--brand-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    display: none;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

[dir="rtl"] .accessibility-panel {
    right: auto;
    left: 0;
}

.accessibility-panel.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accessibility-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.accessibility-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--brand-dark);
}

.accessibility-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.accessibility-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--brand-bg);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: var(--brand-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

[dir="rtl"] .accessibility-btn {
    text-align: right;
}

.accessibility-btn:hover {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.accessibility-btn.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.accessibility-btn i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

body.accessibility-large-text {
    font-size: 18px !important;
}

body.accessibility-larger-text {
    font-size: 20px !important;
}

body.accessibility-high-contrast {
    --brand-bg: #000000;
    --brand-surface: #1a1a1a;
    --brand-dark: #ffffff;
    --brand-muted: #cccccc;
}

body.accessibility-readable-font {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
}

body[data-theme="dark"] .accessibility-panel {
    background: var(--brand-surface);
    border-color: rgba(148, 163, 184, 0.3);
}

body[data-theme="dark"] .accessibility-btn {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--brand-dark);
}

body[data-theme="dark"] .accessibility-btn:hover,
body[data-theme="dark"] .accessibility-btn.active {
    background: var(--brand-primary);
    color: white;
}

/* Footer updates */
.footer a {
    color: rgba(226, 232, 240, 0.85);
    transition: color 0.2s ease;
}

.footer a:hover {
    color: white;
}

body[data-theme="dark"] .footer a {
    color: rgba(226, 232, 240, 0.85);
}

body[data-theme="dark"] .footer a:hover {
    color: white;
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    form,
    .theme-toggle,
    .dropdown,
    .accessibility-widget {
        display: none !important;
    }
}
