/* ==========================================
   Portfolio Custom Styles
   Enhanced UI + Dark Mode Support
   ========================================== */

/* CSS Custom Properties (Light/Dark theme) */
:root {
    --color-bg-base:       #f8fafc;
    --color-bg-surface:    #ffffff;
    --color-bg-card:       #f1f5f9;
    --color-bg-muted:      #e2e8f0;
    --color-text-primary:  #1e293b;
    --color-text-secondary:#475569;
    --color-text-muted:    #94a3b8;
    --color-border:        #e2e8f0;
    --color-shadow:        rgba(0, 0, 0, 0.08);
    --color-accent:        #667eea;
    --color-accent-2:      #764ba2;
    --nav-bg:              rgba(255, 255, 255, 0.92);
    --scrollbar-track:     #f1f5f9;
    --scrollbar-thumb:     #667eea;
}

.dark {
    --color-bg-base:       #0d1117;
    --color-bg-surface:    #161b22;
    --color-bg-card:       #1f2937;
    --color-bg-muted:      #1e293b;
    --color-text-primary:  #e2e8f0;
    --color-text-secondary:#94a3b8;
    --color-text-muted:    #64748b;
    --color-border:        #30363d;
    --color-shadow:        rgba(0, 0, 0, 0.4);
    --color-accent:        #818cf8;
    --color-accent-2:      #a78bfa;
    --nav-bg:              rgba(13, 17, 23, 0.95);
    --scrollbar-track:     #161b22;
    --scrollbar-thumb:     #818cf8;
}

/* ---- Dark mode skill bar text labels ---- */
.dark .skill-item .text-gray-700 { color: #cbd5e1 !important; }
.dark .skill-item .text-gray-500 { color: #64748b !important; }
.dark .bg-gray-200               { background-color: #334155 !important; }

/* ---- Hide back-to-top on mobile (bottom bar serves that purpose) ---- */
@media (max-width: 767px) {
    #back-to-top { display: none !important; }
}

/* ---- Hero scroll indicator bounce ---- */
.scroll-hint {
    animation: bounce-hint 2s ease-in-out infinite;
    opacity: 0.7;
}
@keyframes bounce-hint {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50%       { transform: translateY(8px); opacity: 1; }
}

/* ---- Section background fixes ---- */
.dark section.bg-white  { background-color: var(--color-bg-surface) !important; }
.dark section.bg-gray-50 { background-color: var(--color-bg-base) !important; }

/* ---- Offset sections so dock doesn't overlap content on mid-range screens ---- */
@media (min-width: 768px) and (max-width: 1280px) {
    .max-w-7xl { padding-left: max(2rem, 82px) !important; }
}


    background-color: var(--color-bg-base);
    color: var(--color-text-primary);
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* ---- Dark mode overrides for Tailwind utility classes ---- */
.dark body                         { background-color: var(--color-bg-base) !important; }
.dark .bg-white                    { background-color: var(--color-bg-surface) !important; }
.dark .bg-gray-50                  { background-color: var(--color-bg-base) !important; }
.dark .bg-gray-100                 { background-color: var(--color-bg-muted) !important; }
.dark .bg-gray-200                 { background-color: #2d3748 !important; }

.dark .text-gray-800               { color: var(--color-text-primary) !important; }
.dark .text-gray-700               { color: #cbd5e1 !important; }
.dark .text-gray-600               { color: var(--color-text-secondary) !important; }
.dark .text-gray-500               { color: var(--color-text-muted) !important; }
.dark .text-gray-400               { color: #4b5563 !important; }

/* Nav dark mode */
.dark nav {
    background-color: var(--nav-bg) !important;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 10px rgba(0,0,0,0.4);
}
.dark nav h1                       { color: #e2e8f0 !important; }
/* Card dark mode */
.dark .card-hover                  { border: 1px solid var(--color-border) !important; box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important; }
.dark .card-hover:hover            { box-shadow: 0 12px 35px rgba(0,0,0,0.5) !important; border-color: var(--color-accent) !important; }
.dark .rounded-2xl:not([class*='gradient']) { background-color: var(--color-bg-card) !important; }

/* Badge / tag dark overrides */
.dark .bg-blue-100                 { background-color: rgba(99, 102, 241, 0.18) !important; color: #a5b4fc !important; }
.dark .text-blue-800               { color: #a5b4fc !important; }
.dark .bg-green-100                { background-color: rgba(16, 185, 129, 0.15) !important; color: #6ee7b7 !important; }
.dark .text-green-800              { color: #6ee7b7 !important; }
.dark .bg-purple-100               { background-color: rgba(139, 92, 246, 0.18) !important; color: #c4b5fd !important; }
.dark .text-purple-800             { color: #c4b5fd !important; }
.dark .bg-yellow-100               { background-color: rgba(245, 158, 11, 0.15) !important; color: #fde68a !important; }
.dark .text-yellow-800             { color: #fde68a !important; }

/* Achievement / contact icon circles dark mode */
.dark .bg-blue-100.rounded-full,
.dark .bg-green-100.rounded-full,
.dark .bg-purple-100.rounded-full,
.dark .bg-gray-100.rounded-full    { box-shadow: 0 0 0 1px var(--color-border); }

/* Footer dark adjustment */
.dark footer.bg-gray-800           { background-color: #020617 !important; }
.dark .border-gray-800             { border-color: var(--color-border) !important; }

/* Section headings dark mode */
.dark h2, .dark h3, .dark h4       { color: var(--color-text-primary) !important; }

/* Project card inner text */
.dark .project-card .font-bold     { color: var(--color-text-primary); }
.dark .project-card p              { color: var(--color-text-secondary); }

/* Contact section action buttons */
.dark .border-gray-800.text-gray-800 {
    border-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}
.dark .border-gray-800.text-gray-800:hover {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: #fff !important;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Gradient animations */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Custom gradient background */
.gradient-animated {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 7px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent-2);
}

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus,
textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading animation for images */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .gradient-bg {
        background: #667eea !important;
        color: white !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card-hover {
        border: 2px solid #000;
    }
    
    .gradient-bg {
        background: #000 !important;
        color: #fff !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* Custom utility classes */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.box-shadow-lg {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
}

/* Animation delays for staggered effects */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Floating animation */
.float {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Glow effect */
.glow {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.glow:hover {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* ---- Enhanced project card ---- */
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-surface);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px var(--color-shadow);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px var(--color-shadow);
    border-color: var(--color-accent);
}
.project-card .card-img {
    width: 100%;
    height: 155px;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.project-card:hover .card-img {
    transform: scale(1.04);
}
.project-card .card-body {
    padding: 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.project-card .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}
.project-card .card-desc {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
    flex: 1;
}
.project-card .card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.project-card .tag {
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.25);
    letter-spacing: 0.02em;
    transition: background 0.2s;
}
.dark .project-card .tag {
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    border-color: rgba(129, 140, 248, 0.3);
}
.project-card .card-links {
    display: flex;
    gap: 12px;
    margin-top: auto;
}
.project-card .card-link {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.project-card .card-link:hover        { color: var(--color-accent); }
.project-card .card-link.github:hover { color: #24292f; }
.dark .project-card .card-link.github:hover { color: #e2e8f0; }
.project-card .card-link.live:hover   { color: #10b981; }

/* Stars badge */
.project-card .stars-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.55);
    color: #fbbf24;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
}
.project-card .card-img-wrap {
    position: relative;
    overflow: hidden;
}

/* ---- Skill bar shimmer ---- */
.skill-bar-container {
    position: relative;
    overflow: hidden;
    border-radius: 99px;
}
.skill-bar-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmer 2.2s ease-in-out infinite;
}
@keyframes shimmer {
    0%   { left: -60%; }
    100% { left: 130%; }
}

/* ---- Hero CTA buttons ---- */
.hero-btn {
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 50px;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
    font-size: 0.9rem;
}
.hero-btn.primary {
    background: #fff;
    color: #667eea;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.hero-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    background: #f0f4ff;
}
.hero-btn.outline {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.7);
}
.hero-btn.outline:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
    transform: translateY(-2px);
}
.hero-btn.resume-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(4px);
}
.hero-btn.resume-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.1));
    border-color: #fbbf24;
    color: #fbbf24;
    transform: translateY(-2px);
}

/* ---- Gradient text accent ---- */
.gradient-text {
    background: linear-gradient(135deg, #667eea, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Section decorative line ---- */
.section-title-line {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    margin: 12px auto 0;
}

/* ---- Profile avatar ring ---- */
.avatar-ring {
    box-shadow: 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(255,255,255,0.1);
    animation: ring-pulse 3s ease-in-out infinite;
}
@keyframes ring-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255,255,255,0.3), 0 0 0 8px rgba(255,255,255,0.1); }
    50%       { box-shadow: 0 0 0 6px rgba(255,255,255,0.4), 0 0 0 12px rgba(255,255,255,0.05); }
}

/* ---- Skill category card ---- */
.skill-cat-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 2px 12px var(--color-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.skill-cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px var(--color-shadow);
}
.dark .skill-cat-card {
    background: var(--color-bg-card);
}
