:root {
    --bg-color: #f4f4f5;
    --card-bg: #ffffff;
    --primary-color: #18181b;
    --text-primary: #18181b;
    --text-muted: #71717a;
    --border-color: #e4e4e7;
    --border-hover: #d4d4d8;
    --card-hover-bg: #ffffff;
    --blob-1: #e4e4e7;
    --blob-2: #f4f4f5;
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --text-primary-rgb: 24, 24, 27;
    --primary-rgb: 24, 24, 27;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg-color: #09090b;
    --card-bg: #18181b;
    --primary-color: #d4d4d8;
    --text-primary: #d4d4d8;
    --text-muted: #a1a1aa;
    --border-color: #27272a;
    --border-hover: #3f3f46;
    --card-hover-bg: #1d1d21;
    --blob-1: #18181b;
    --blob-2: #09090b;
    --glass-bg: rgba(24, 24, 27, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --text-primary-rgb: 212, 212, 216;
    --primary-rgb: 212, 212, 216;
    color-scheme: dark;
}

/* Form Elements */
.form-control,
.form-select {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.6rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.form-select option {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #1d1d21;
    border-color: var(--border-color);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--card-hover-bg);
    border-color: var(--text-muted);
    color: var(--text-primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
    outline: none;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Base Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 0.925rem;
    /* Reduced base size */
}

/* Background Grain & Blobs */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Simplified noise filter for better performance in Safari */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -2;
    animation: drift 20s infinite alternate;
    /* Force GPU acceleration for Safari */
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background-color: var(--blob-1);
    opacity: 0.7;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background-color: var(--blob-2);
    opacity: 0.7;
    animation-delay: -5s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

/* Typography */
h1,
.h1 {
    font-size: 1.5rem;
}

h2,
.h2 {
    font-size: 1.25rem;
}

h3,
.h3 {
    font-size: 1.1rem;
}

h4,
.h4 {
    font-size: 1rem;
}

h5,
.h5 {
    font-size: 0.95rem;
}

h6,
.h6 {
    font-size: 0.9rem;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

.text-muted-custom {
    color: var(--text-muted) !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

/* Custom Card */
.custom-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    transition: all 0.2s ease-in-out;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.custom-card:hover {
    background-color: var(--card-hover-bg);
}

/* Disable hover effects for static cards */
.custom-card.no-hover:hover {
    border-color: var(--border-color);
    background-color: var(--card-bg);
    transform: none;
    box-shadow: none;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.card-link:hover {
    color: inherit;
}

/* Profile Section */
.profile-img {
    width: 100%;
    max-width: 250px;
    border-radius: 1rem;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.profile-img:hover {
    filter: grayscale(0%);
}

@media (max-width: 991px) {
    .profile-img {
        width: 70px !important;
        height: 70px !important;
        max-width: 70px !important;
        border-radius: 12px;
    }

    .main-wrapper {
        padding-top: calc(1rem + env(safe-area-inset-top, 0px)) !important;
    }
}

.social-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--card-bg);
    color: var(--text-muted);
    transition: all 0.2s;
    text-decoration: none;
    border-radius: 50%;
}

.social-btn:hover {
    background: var(--card-hover-bg);
    color: var(--primary-color);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 1rem;
}

/* Chat Activity */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    max-width: 85%;
    position: relative;
    line-height: 1.45;
    font-weight: 400;
}

.bubble-left {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

.bubble-right {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

[data-theme="dark"] .bubble-right {
    color: var(--bg-color);
}

/* Tools & Icons */
.icon-square {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--primary-color);
    border-radius: 0.75rem;
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .icon-square {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

[data-theme="dark"] .bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

[data-theme="dark"] .bg-info-subtle {
    background-color: rgba(6, 182, 212, 0.15) !important;
}

[data-theme="dark"] .bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

[data-theme="dark"] .text-primary {
    color: #60a5fa !important;
}

[data-theme="dark"] .text-warning {
    color: #fbbf24 !important;
}

[data-theme="dark"] .text-info {
    color: #22d3ee !important;
}

[data-theme="dark"] .text-success {
    color: #34d399 !important;
}

.badge.bg-light {
    background-color: #f4f4f5 !important;
    color: #71717a !important;
    border-color: #e4e4e7 !important;
    font-weight: 500;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #27272a !important;
    color: #e4e4e7 !important;
    border-color: #3f3f46 !important;
}

[data-theme="dark"] .opacity-25 {
    opacity: 0.6 !important;
    color: #fafafa !important;
}

[data-theme="dark"] .text-muted {
    color: #a1a1aa !important;
    opacity: 0.8 !important;
}

[data-theme="dark"] .fa-arrow-right,
[data-theme="dark"] .fa-external-link-alt,
[data-theme="dark"] .fa-download {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}

/* Clean List */
.clean-list-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid transparent;
}

.clean-list-item:hover .arrow-icon {
    transform: translateX(4px);
    opacity: 1;
}

.arrow-icon {
    transition: all 0.2s;
    opacity: 0.5;
}

/* Utility */
.badge-price {
    background: #ecfdf5;
    color: #059669;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dashed-divider {
    border-top: 1px dashed var(--border-color);
    margin: 2rem 0;
}

/* Footer Border Fix */
footer.border-top {
    border-top-color: var(--border-color) !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Custom Container Width */
.container {
    max-width: 1100px !important;
}

/* Dark Mode Transitions */
body,
.custom-card,
.social-btn,
.glass-card,
.chat-bubble,
.icon-square,
.blob {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s ease;
}

/* Profile Button Fix */
.auth-profile-container {
    background-color: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    transition: all 0.2s ease;
}

[data-theme="dark"] .auth-profile-container {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-primary) !important;
    border-color: transparent !important;
}

.logout-icon-wrapper {
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.logout-icon-wrapper:hover {
    transform: scale(1.1);
    background-color: rgba(220, 53, 69, 0.25) !important;
}

[data-theme="dark"] .bg-danger-subtle {
    background-color: rgba(220, 53, 69, 0.15) !important;
}

/* Theme Switcher */
.theme-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: default !important;
    padding: 0;
}

/* No hover background as requested */
.theme-btn:hover {
    background: transparent;
}

.theme-btn.active {
    background: var(--border-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.theme-btn i {
    font-size: 0.85rem;
}

/* Rotation Animation */
.rotating-text {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    pointer-events: none;
}

.rotating-text.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (max-width: 768px) {
    .footer-rotator {
        display: flex;
        justify-content: center;
        min-width: 100% !important;
    }

    .rotating-text {
        left: 50%;
        transform: translate(-50%, 10px);
    }

    .rotating-text.active {
        transform: translate(-50%, 0);
    }
}

/* Info Button & Popover */
.activity-title {
    color: var(--text-primary) !important;
    font-weight: 500;
    font-size: 0.8rem;
}

.info-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.info-btn:hover {
    color: var(--primary-color);
}

.popover {
    --bs-popover-bg: var(--card-bg);
    --bs-popover-border-color: var(--border-color);
    --bs-popover-header-bg: var(--bg-color);
    --bs-popover-header-color: var(--text-primary);
    --bs-popover-body-color: var(--text-muted);
    --bs-popover-border-radius: 0.75rem;
    --bs-popover-box-shadow: var(--shadow-hover);
    font-size: 0.75rem;
    max-width: 250px;
}

[data-theme="dark"] .popover {
    --bs-popover-bg: #1d1d21;
    --bs-popover-body-color: #e4e4e7;
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--text-primary);
    color: var(--card-bg);
    border-color: var(--text-primary);
}

/* Resource Card */
.resource-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.resource-card:hover {
    border-color: var(--border-hover);
    background: var(--card-hover-bg);
    box-shadow: var(--shadow-hover);
    color: inherit;
}

.resource-tag {
    background: #ecfdf5;
    color: #059669;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

[data-theme="dark"] .resource-tag {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.resources-list {
    margin-top: 1rem;
}

/* Back Button */
.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    border-color: var(--border-hover);
    background: var(--card-hover-bg);
    color: var(--primary-color);
}

/* Project Card with Hover Preview */
.project-card {
    position: relative;
    overflow: visible;
}

.project-preview {
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.project-preview::before {
    content: "";
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: inherit;
    filter: blur(30px);
    opacity: 0.6;
    z-index: -1;
    border-radius: 1rem;
}

.project-preview img {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 3px solid var(--card-bg);
}

.project-card:hover .project-preview {
    opacity: 1;
    transform: translateY(-50%) scale(1) translateX(20px);
}

@media (max-width: 992px) {
    .project-preview {
        display: none;
    }
}

/* Resource Content / Blog Style */
.resource-content {
    line-height: 1.8;
}

.resource-content h2 {
    margin-top: 2rem;
}

.resource-content p {
    margin-bottom: 1rem;
}

.resource-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.resource-content a:hover {
    text-decoration: underline;
}

.resource-content code {
    background: var(--bg-color);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.resource-content ol,
.resource-content ul {
    padding-left: 1.5rem;
}

/* Code Block */
.code-block-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.code-block-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-block-actions {
    display: flex;
    gap: 0.5rem;
}

.code-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.code-action-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.code-block {
    margin: 0;
    padding: 1rem 1.25rem;
    background: #0d1117;
    color: #c9d1d9;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
}

[data-theme="light"] .code-block {
    background: #1e1e1e;
    color: #d4d4d4;
}

.code-block code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Typewriter & Fade Animation */
@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes blink {
    50% {
        border-color: transparent
    }
}

.animate-typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: typing 3.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    max-width: fit-content;
    vertical-align: middle;
}

/* Resource Card specific style to match flat aesthetic */
.resource-card-flat {
    background: transparent !important;
    border: 1px solid var(--border-color);
    box-shadow: none !important;
    border-radius: 1rem;
    position: relative;
    transition: all 0.2s ease-in-out;
}

.resource-card-flat:hover {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color);
}

[data-theme="dark"] .resource-card-flat {
    background: transparent !important;
    border-color: #27272a;
}

[data-theme="dark"] .resource-card-flat:hover {
    background-color: var(--card-hover-bg) !important;
}

/* Language Switcher & Dropdown Customization */
.lang-btn {
    transition: all 0.2s ease;
    border: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
}

.lang-btn:hover {
    border-color: var(--text-muted) !important;
    background: var(--card-hover-bg) !important;
}

[data-theme="dark"] .lang-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .lang-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Premium Dropdown Styles */
.dropdown-menu.glass-card {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-hover) !important;
    min-width: 140px;
}

[data-theme="dark"] .dropdown-menu.glass-card {
    background-color: rgba(24, 24, 27, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dropdown-item {
    color: var(--text-muted) !important;
    padding: 0.6rem 0.8rem;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.dropdown-item:hover {
    background-color: var(--card-hover-bg) !important;
    color: var(--text-primary) !important;
}

.dropdown-item.active {
    background-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

[data-theme="dark"] .dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

/* Custom Breadcrumbs - Premium Design */
.custom-breadcrumb {
    display: flex;
    width: 100%;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 1rem;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2.5rem;
}

.custom-breadcrumb .breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.custom-breadcrumb .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.custom-breadcrumb .breadcrumb-item a:hover {
    color: var(--text-primary);
}

.custom-breadcrumb .breadcrumb-item+.breadcrumb-item::before {
    content: "•";
    padding-right: 6px;
    color: var(--border-color);
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
}

.custom-breadcrumb .breadcrumb-item.active {
    color: #10b981;
    font-weight: 700;
}

.custom-breadcrumb .breadcrumb-item.active::before {
    color: var(--border-color) !important;
}

.custom-breadcrumb .breadcrumb-item i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Hide breadcrumb default Bootstrap separator if it persists */
.breadcrumb-item+.breadcrumb-item::before {
    float: left;
}