/* Custom styles for Digital Biz Talk - Enhanced Edition */

/* ========== CSS Variables ========== */
:root {
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ========== Toggle Switch ========== */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 24px;
    position: relative;
    transition: background-color 0.2s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2563eb;
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Tailwind peer classes fallback */
.peer:checked ~ .peer-checked\:bg-blue-600 {
    background-color: #2563eb !important;
}

.peer:checked ~ div::after {
    transform: translateX(20px) !important;
}

/* ========== Base Styles ========== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ========== Utility Classes ========== */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Smooth Transitions ========== */
a, button {
    transition: all var(--transition-normal);
}

/* ========== Navigation Enhancements ========== */
.nav-link {
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Mobile Navigation Animation */
.mobile-nav-enter {
    animation: slideDown 0.3s ease forwards;
}

.mobile-nav-exit {
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ========== Hero Section ========== */
.hero-gradient {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 50%, #1e293b 100%);
    position: relative;
    overflow: hidden;
}

.hero-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 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='%23ffffff' 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");
    pointer-events: none;
}

/* ========== Article Content Styling ========== */
.article-content {
    line-height: 1.8;
    font-size: 1.125rem;
}

.article-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--gray-900);
    scroll-margin-top: 100px;
}

.article-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
    scroll-margin-top: 100px;
}

.article-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--gray-700);
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.75rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.article-content a {
    color: var(--primary-600);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

.article-content a:hover {
    color: var(--primary-700);
}

.article-content blockquote {
    border-left: 4px solid var(--primary-500);
    padding-left: 1.5rem;
    font-style: italic;
    color: var(--gray-600);
    margin: 2rem 0;
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.article-content pre {
    background-color: var(--gray-900);
    color: #f9fafb;
    padding: 1.25rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 2rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.article-content code {
    background-color: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875em;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    color: var(--primary-700);
}

.article-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}

.article-content img {
    border-radius: 0.75rem;
    margin: 2rem auto;
    max-width: 100%;
    height: auto;
    box-shadow: var(--shadow-lg);
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.article-content th,
.article-content td {
    padding: 1rem;
    border: 1px solid var(--gray-200);
    text-align: left;
}

.article-content th {
    background-color: var(--gray-50);
    font-weight: 600;
    color: var(--gray-900);
}

.article-content tr:hover {
    background-color: var(--gray-50);
}

/* Affiliate link styling */
.article-content a[rel*="nofollow"] {
    color: #059669;
    font-weight: 500;
    text-decoration: none;
    background: linear-gradient(90deg, #d1fae5 0%, #a7f3d0 100%);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    transition: all var(--transition-fast);
}

.article-content a[rel*="nofollow"]:hover {
    background: linear-gradient(90deg, #a7f3d0 0%, #6ee7b7 100%);
    color: #047857;
}

/* ========== Card Components ========== */
.card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-image {
    overflow: hidden;
}

.card-image img {
    transition: transform var(--transition-slow);
}

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

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.39);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(14, 165, 233, 0.5);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

/* ========== Loading States ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-radius: 50%;
    border-top-color: var(--primary-500);
    animation: spin 0.8s ease-in-out infinite;
}

.loading-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== Scroll to Top Button ========== */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    z-index: 99;
    border: none;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-4px);
    box-shadow: 0 6px 25px rgba(14, 165, 233, 0.5);
}

/* ========== Reading Progress Bar ========== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-400), var(--primary-600), #8b5cf6);
    z-index: 100;
    transition: width 0.1s ease;
}

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 2rem;
    background: var(--gray-900);
    color: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    opacity: 0;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: linear-gradient(135deg, #059669, #047857);
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.toast-info {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
}

/* ========== Push Notification Banner ========== */
.notification-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--gray-800), var(--gray-900));
    color: white;
    padding: 1rem;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.notification-banner.show {
    transform: translateY(0);
}

.notification-banner-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.notification-banner-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-banner-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-banner-buttons {
    display: flex;
    gap: 0.75rem;
}

.notification-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.notification-btn-primary {
    background: white;
    color: var(--gray-900);
}

.notification-btn-primary:hover {
    background: var(--gray-100);
}

.notification-btn-secondary {
    background: transparent;
    color: var(--gray-300);
    border: 1px solid var(--gray-600);
}

.notification-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ========== Category Pills ========== */
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.category-pill:hover {
    background: var(--gray-200);
    transform: translateY(-1px);
}

/* ========== Tag Cloud ========== */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud a {
    padding: 0.375rem 0.875rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 9999px;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
}

.tag-cloud a:hover {
    background: var(--primary-100);
    color: var(--primary-700);
    transform: scale(1.05);
}

/* ========== Newsletter Section ========== */
.newsletter-section {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
    position: relative;
    overflow: hidden;
}

.newsletter-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ========== Table of Contents ========== */
.toc {
    background: var(--gray-50);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.toc-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: var(--gray-600);
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
}

.toc-list a:hover,
.toc-list a.active {
    color: var(--primary-600);
    border-left-color: var(--primary-500);
}

.toc-list a.active {
    font-weight: 500;
}

/* ========== Share Buttons ========== */
.share-buttons {
    display: flex;
    gap: 0.75rem;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.share-btn-twitter { background: #1da1f2; }
.share-btn-facebook { background: #4267B2; }
.share-btn-linkedin { background: #0077b5; }
.share-btn-whatsapp { background: #25D366; }
.share-btn-email { background: var(--gray-600); }

/* ========== Responsive Utilities ========== */
@media (max-width: 640px) {
    .article-content {
        font-size: 1rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.25rem;
    }

    .scroll-top {
        bottom: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
    }

    .notification-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .notification-banner-buttons {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .mobile-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background-color: white;
        border-top: 1px solid var(--gray-200);
        padding: 1rem;
        box-shadow: var(--shadow-lg);
    }

    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* ========== Print Styles ========== */
@media print {
    .scroll-top,
    .notification-banner,
    .share-buttons,
    nav,
    footer {
        display: none !important;
    }

    .article-content {
        font-size: 12pt;
        line-height: 1.6;
    }

    .article-content a {
        text-decoration: underline;
    }

    .article-content a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--gray-500);
    }
}

/* ========== Accessibility ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ========== Selection Color ========== */
::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

/* ========== Scrollbar Styling ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========== Form Enhancements ========== */
input, textarea, select {
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
    border-color: var(--primary-500);
}

/* ========== Gradient Text ========== */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-500), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== Pulse Animation for Notifications ========== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
    }
}

/* ========== Badge Component ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background: #d1fae5;
    color: #047857;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}
