/* Custom styles for the portfolio site */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-color: #f8fafc; /* slate-50 */
    color: #1e293b; /* slate-800 */
}

/* Add dark mode background and text colors */
body.dark-theme {
    background-color: #0f172a; /* slate-900 */
    color: #f1f5f9; /* slate-100 */
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for chat */
#chat-messages::-webkit-scrollbar {
    width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #e2e8f0; /* slate-200 */
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #94a3b8; /* slate-400 */
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #64748b; /* slate-500 */
}

/* Dark mode custom scrollbar */
body.dark-theme #chat-messages::-webkit-scrollbar-track {
    background: #334155; /* slate-700 */
}

body.dark-theme #chat-messages::-webkit-scrollbar-thumb {
    background: #94a3b8; /* slate-400 */
}

body.dark-theme #chat-messages::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1; /* slate-300 */
}

/* Animation for new chat messages */
.message-animation {
    animation: fadeIn 0.3s ease-in;
}

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

/* Fade in up animation for main content */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
}

/* Enhanced animated background for the body */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    opacity: 0.6;
}

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 70%);
    animation: float 25s infinite linear;
    filter: blur(1px);
}

.bg-bubble:nth-child(1) {
    width: 250px;
    height: 250px;
    top: 10%;
    left: 20%;
    animation-duration: 30s;
    opacity: 0.7;
}

.bg-bubble:nth-child(2) {
    width: 180px;
    height: 180px;
    top: 60%;
    left: 70%;
    animation-duration: 35s;
    opacity: 0.6;
}

.bg-bubble:nth-child(3) {
    width: 120px;
    height: 120px;
    top: 30%;
    left: 80%;
    animation-duration: 28s;
    opacity: 0.8;
}

.bg-bubble:nth-child(4) {
    width: 150px;
    height: 150px;
    top: 70%;
    left: 15%;
    animation-duration: 32s;
    opacity: 0.5;
}

.bg-bubble:nth-child(5) {
    width: 100px;
    height: 100px;
    top: 40%;
    left: 50%;
    animation-duration: 25s;
    opacity: 0.4;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(50px, 80px) rotate(90deg);
    }
    50% {
        transform: translate(0, 120px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, 80px) rotate(270deg);
    }
    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

/* Dark mode styles for animated background */
body.dark-theme .bg-bubble {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0) 70%);
}

body.dark-theme .bg-bubble:nth-child(1) {
    background: radial-gradient(circle, rgba(129, 140, 248, 0.25) 0%, rgba(129, 140, 248, 0) 70%);
}

body.dark-theme .bg-bubble:nth-child(2) {
    background: radial-gradient(circle, rgba(165, 180, 252, 0.2) 0%, rgba(165, 180, 252, 0) 70%);
}

body.dark-theme .bg-bubble:nth-child(3) {
    background: radial-gradient(circle, rgba(199, 210, 254, 0.2) 0%, rgba(199, 210, 254, 0) 70%);
}

body.dark-theme .bg-bubble:nth-child(4) {
    background: radial-gradient(circle, rgba(147, 197, 253, 0.15) 0%, rgba(147, 197, 253, 0) 70%);
}

body.dark-theme .bg-bubble:nth-child(5) {
    background: radial-gradient(circle, rgba(100, 143, 255, 0.18) 0%, rgba(100, 143, 255, 0) 70%);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    color: #64748b; /* slate-500 */
}

.theme-toggle:hover {
    background-color: #e2e8f0; /* slate-200 */
    color: #475569; /* slate-600 */
}

/* Dark mode theme toggle */
body.dark-theme .theme-toggle {
    color: #94a3b8; /* slate-400 */
}

body.dark-theme .theme-toggle:hover {
    background-color: #475569; /* slate-600 */
    color: #e2e8f0; /* slate-200 */
}

/* Header styles */
header {
    background-color: white;
    color: #1e293b; /* slate-800 */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

body.dark-theme header {
    background-color: #1e293b; /* slate-800 */
    color: #f1f5f9; /* slate-100 */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Header navigation links */
header a {
    color: #64748b; /* slate-500 */
}

header a:hover {
    color: #3b82f6; /* blue-500 */
}

body.dark-theme header a {
    color: #cbd5e1; /* slate-300 */
}

body.dark-theme header a:hover {
    color: #93c5fd; /* blue-400 */
}

/* Header brand link */
header a.text-blue-600 {
    color: #2563eb; /* blue-600 */
}

body.dark-theme header a.text-blue-600 {
    color: #60a5fa; /* blue-400 */
}

body.dark-theme header a.text-blue-600:hover {
    color: #93c5fd; /* blue-400 */
}

/* Footer styles */
footer {
    background-color: white;
    color: #64748b; /* slate-500 */
    border-top: 1px solid #e2e8f0; /* slate-200 */
}

body.dark-theme footer {
    background-color: #1e293b; /* slate-800 */
    color: #cbd5e1; /* slate-300 */
    border-top: 1px solid #334155; /* slate-700 */
}

/* Footer links */
footer a {
    color: #64748b; /* slate-500 */
}

footer a:hover {
    color: #3b82f6; /* blue-500 */
}

body.dark-theme footer a {
    color: #94a3b8; /* slate-400 */
}

body.dark-theme footer a:hover {
    color: #60a5fa; /* blue-400 */
}

/* Override Tailwind classes for dark mode */
body.dark-theme .bg-white {
    background-color: #0f172a; /* slate-900 */
}

body.dark-theme .text-gray-70 {
    color: #e2e8f0; /* slate-100 */
}

body.dark-theme .text-gray-600 {
    color: #cbd5e1; /* slate-300 */
}

body.dark-theme .text-blue-600 {
    color: #60a5fa; /* blue-400 */
}

body.dark-theme .hover\:text-blue-600:hover {
    color: #93c5fd; /* blue-400 */
}

body.dark-theme .bg-green-100 {
    background-color: #166534; /* green-800 */
}

body.dark-theme .text-green-700 {
    color: #86efac; /* green-300 */
}

body.dark-theme .bg-red-100 {
    background-color: #991b1b; /* red-800 */
}

body.dark-theme .text-red-700 {
    color: #fca5a5; /* red-300 */
}

body.dark-theme .hover\:text-blue-600:hover {
    color: #93c5fd;
}

body.dark-theme .text-gray-800 {
    color: #f1f5f9; /* slate-100 */
}

body.dark-theme .bg-gray-50 {
    background-color: #0f172a; /* slate-900 */
}

body.dark-theme .text-gray-900 {
    color: #f8fafc; /* slate-50 */
}

body.dark-theme .border-gray-200 {
    border-color: #334155; /* slate-700 */
}

body.dark-theme .hover\:bg-gray-100:hover {
    background-color: #334155; /* slate-700 */
}

/* Card styles */
.card {
    background-color: white;
    color: #1e293b; /* slate-800 */
    border: 1px solid #e2e8f0; /* slate-200 */
}

body.dark-theme .card {
    background-color: #334155; /* slate-700 */
    color: #f1f5f9; /* slate-100 */
    border-color: #475569; /* slate-600 */
}

/* Button styles */
.button, .btn {
    background-color: #3b82f6; /* blue-500 */
    color: white;
    border: none;
}

.button:hover, .btn:hover {
    background-color: #2563eb; /* blue-600 */
}

body.dark-theme .button, 
body.dark-theme .btn {
    background-color: #60a5fa; /* blue-400 */
    color: #0f172a; /* slate-900 */
}

body.dark-theme .button:hover, 
body.dark-theme .btn:hover {
    background-color: #93c5fd; /* blue-300 */
}

/* Hover effects for service cards */
.group:hover .service-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Mobile menu styles */
.mobile-menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    color: #64748b; /* slate-500 */
    transition: background-color 0.2s;
}

.mobile-menu-button:hover {
    background-color: #e2e8f0; /* slate-200 */
}

body.dark-theme .mobile-menu-button {
    color: #94a3b8; /* slate-400 */
}

body.dark-theme .mobile-menu-button:hover {
    background-color: #475569; /* slate-600 */
}

/* Mobile navigation links */
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body.dark-theme .mobile-nav-links {
    background: #334155; /* slate-700 */
    color: #f1f5f9; /* slate-100 */
}

.mobile-nav-links li {
    margin: 0.25rem 0;
    width: 100%;
}

.mobile-nav-links a {
    padding: 0.75rem 1rem;
    display: block;
    width: 100%;
    color: #1e293b; /* slate-800 */
}

.mobile-nav-links a:hover {
    background-color: #f1f5f9; /* slate-100 */
}

body.dark-theme .mobile-nav-links a {
    color: #f1f5f9; /* slate-100 */
}

body.dark-theme .mobile-nav-links a:hover {
    background-color: #475569; /* slate-600 */
}

/* Additional dark mode overrides for Tailwind classes */
body.dark-theme .text-gray-800 {
    color: #f1f5f9; /* slate-100 */
}

body.dark-theme .text-gray-600 {
    color: #cbd5e1; /* slate-30 */
}

body.dark-theme .text-white {
    color: #f8fafc; /* slate-50 */
}

body.dark-theme .bg-blue-600 {
    background-color: #3b82f6; /* blue-500 - keeping the same for now */
}

body.dark-theme .text-blue-600 {
    color: #60a5fa; /* blue-40 */
}

body.dark-theme .hover\:text-blue-600:hover {
    color: #93c5fd; /* blue-30 */
}

body.dark-theme .hover\:text-blue-800:hover {
    color: #93c5fd; /* blue-30 */
}

body.dark-theme .bg-white {
    background-color: #1e293b; /* slate-800 */
}

body.dark-theme .border-gray-100 {
    border-color: #334155; /* slate-70 */
}

body.dark-theme .border-gray-200 {
    border-color: #475569; /* slate-600 */
}

body.dark-theme .bg-blue-100 {
    background-color: #1e3a8a; /* blue-900 */
}

body.dark-theme .bg-green-100 {
    background-color: #166534; /* green-900 */
}

body.dark-theme .text-green-600 {
    color: #4ade80; /* green-400 */
}

body.dark-theme .bg-purple-100 {
    background-color: #581c87; /* violet-900 */
}

body.dark-theme .text-purple-600 {
    color: #a78bfa; /* violet-400 */
}

body.dark-theme .bg-gray-200 {
    background-color: #475569; /* slate-600 */
}

body.dark-theme .text-gray-900 {
    color: #f8fafc; /* slate-50 */
}

body.dark-theme .text-gray-500 {
    color: #94a3b8; /* slate-400 */
}

body.dark-theme .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: #334155; /* slate-70 */
}

body.dark-theme .bg-blue-50 {
    background-color: #1e293b; /* slate-800 */
}

body.dark-theme .border-blue-200 {
    border-color: #60a5fa; /* blue-40 */
}

body.dark-theme .border-t {
    border-top-color: #334155; /* slate-700 */
}

body.dark-theme .border-gray-200 {
    border-color: #334155; /* slate-700 */
}

body.dark-theme .bg-gray-800 {
    background-color: #334155; /* slate-700 */
}

body.dark-theme .hover\:bg-black:hover {
    background-color: #0f172a; /* slate-900 */
}

body.dark-theme .border-gray-300 {
    border-color: #475569; /* slate-600 */
}

body.dark-theme .focus\:ring-blue-500:focus {
    --tw-ring-color: #3b82f6; /* blue-500 */
}

body.dark-theme .focus\:border-transparent:focus {
    border-color: transparent;
}

body.dark-theme .hover\:bg-blue-700:hover {
    background-color: #2563eb; /* blue-600 */
}

/* Override for gradient backgrounds */
body.dark-theme .bg-gradient-to-r.from-blue-50.to-indigo-50 {
    background: linear-gradient(to right, #1e293b, #1e293b) !important; /* Use dark slate as base */
}

/* Override for form elements */
body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select {
    background-color: #1e293b; /* slate-800 */
    color: #f1f5f9; /* slate-100 */
    border-color: #475569; /* slate-600 */
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #94a3b8; /* slate-40 */
}

/* Override for buttons */
body.dark-theme .bg-blue-600 {
    background-color: #2563eb; /* blue-600 */
}

body.dark-theme .hover\:bg-blue-700:hover {
    background-color: #3b82f6; /* blue-500 */
}

/* Override for active filter buttons */
body.dark-theme .bg-gray-200.text-gray-70 {
    background-color: #475569; /* slate-600 */
    color: #e2e8f0; /* slate-10 */
}

body.dark-theme .hover\:bg-gray-300:hover {
    background-color: #64748b; /* slate-500 */
}

body.dark-theme .bg-blue-100.text-blue-800 {
    background-color: #1e40af; /* blue-900 */
    color: #93c5fd; /* blue-300 */
}

body.dark-theme .text-blue-800 {
    color: #93c5fd; /* blue-300 */
}

/* Override for success/error messages in forms */
body.dark-theme .text-red-600 {
    color: #f87171; /* red-40 */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .grid {
        gap: 1rem;
    }
    
    /* Adjust hero section for mobile */
    .hero-section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    /* Hide animated background on mobile for performance */
    .bg-bubble {
        display: none;
    }
    
    /* Mobile navigation adjustments */
    .header-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* Mobile service cards */
    .service-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile portfolio preview */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile call to action */
    .cta-button {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .secondary-button {
        width: 100%;
    }
    
    /* Mobile theme toggle positioning */
    .theme-toggle-container {
        position: absolute;
        right: 1rem;
        top: 1rem;
    }
    
    /* Mobile footer */
    .footer-content {
        text-align: center;
    }
    
    /* Mobile admin dashboard */
    .admin-nav {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-nav a {
        margin-bottom: 0.5rem;
    }
    
    /* Mobile admin filter buttons */
    .admin-filter-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-filter-buttons a {
        margin-bottom: 0.5rem;
    }
    
    /* Mobile admin table */
    .admin-table {
        font-size: 0.875rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
        word-break: break-word;
    }
    
    /* Mobile chat */
    .chat-input-container {
        flex-direction: column;
    }
    
    .chat-input {
        width: 100%;
        margin-bottom: 0.5rem;
        border-radius: 0.5rem;
    }
    
    .chat-send-button {
        width: 100%;
        border-radius: 0.5rem;
    }
    
    /* Mobile logs filter */
    .logs-filter-form {
        grid-template-columns: 1fr;
    }
    
    .logs-filter-form > div {
        width: 100%;
    }
    
    .logs-filter-submit {
        justify-self: center;
    }
    
    /* Mobile form elements */
    .form-input {
        width: 100%;
    }
    
    .form-button {
        width: 100%;
    }
    
    /* Mobile buttons */
    .button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile grid adjustments */
    .grid-cols-1 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

/* Extra small devices (phones, 640px and down) */
@media (max-width: 640px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .hero-section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Mobile buttons */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Mobile cards */
    .card {
        padding: 1rem;
    }
    
    /* Mobile typography */
    .text-xl {
        font-size: 1.25rem;
    }
    
    .text-lg {
        font-size: 1.125rem;
    }
    
    .text-base {
        font-size: 1rem;
    }
    
    /* Mobile navigation */
    .nav-menu {
        flex-direction: column;
        width: 100%;
    }
    
    /* Mobile header */
    .header-content {
        flex-direction: row;
        align-items: center;
    }
    
    .header-brand {
        margin-bottom: 0;
    }
}

/* Landscape mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Compact layout for landscape */
    .content-container {
        padding: 1rem 0.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets for mobile devices */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
    
    .nav-link {
        padding: 12px 8px;
    }
    
    .button {
        padding: 12px 16px;
    }
    
    /* Reduce animations for mobile devices */
    body {
        scroll-behavior: auto;
    }
}