/* 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;
}

/* 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: #f1f5f9;
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 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 theme styles */
body.dark-theme {
    background-color: #1a202c;
    color: #e2e8f0;
}

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%);
}

body.dark-theme .bg-gray-50 {
    background-color: #1a202c;
}

body.dark-theme .bg-white {
    background-color: #2d3748;
}

body.dark-theme .text-gray-800 {
    color: #e2e8f0;
}

body.dark-theme .text-gray-600 {
    color: #a0aec0;
}

body.dark-theme .text-gray-700 {
    color: #cbd5e0;
}

body.dark-theme .border-t {
    border-color: #4a5568;
}

body.dark-theme .shadow-sm {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
}

body.dark-theme .shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

body.dark-theme .shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body.dark-theme .shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body.dark-theme .bg-blue-100 {
    background-color: #3182ce;
}

body.dark-theme .text-blue-600 {
    color: #63b3ed;
}

body.dark-theme .bg-green-100 {
    background-color: #38a169;
}

body.dark-theme .text-green-600 {
    color: #68d391;
}

body.dark-theme .bg-purple-100 {
    background-color: #805ad5;
}

body.dark-theme .text-purple-600 {
    color: #b794f6;
}

body.dark-theme .bg-yellow-100 {
    background-color: #d69e2e;
}

body.dark-theme .text-yellow-800 {
    color: #f6e05e;
}

body.dark-theme .bg-gray-100 {
    background-color: #4a5568;
}

body.dark-theme .bg-gray-200 {
    background-color: #718096;
}

body.dark-theme .border-gray-100 {
    border-color: #4a5568;
}

body.dark-theme .bg-gradient-to-r {
    background: linear-gradient(90deg, #2d3748 0%, #1a202c 100%);
}

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

.theme-toggle:hover {
    background-color: #e2e8f0;
    color: #2d3748;
}

body.dark-theme .theme-toggle {
    color: #a0aec0;
}

body.dark-theme .theme-toggle:hover {
    background-color: #4a5568;
    color: #e2e8f0;
}

/* 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: #4a5568;
    transition: background-color 0.2s;
}

.mobile-menu-button:hover {
    background-color: #e2e8f0;
}

body.dark-theme .mobile-menu-button {
    color: #a0aec0;
}

body.dark-theme .mobile-menu-button:hover {
    background-color: #4a5568;
}

/* 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: #2d3748;
}

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

.mobile-nav-links a {
    padding: 0.75rem 1rem;
    display: block;
    width: 100%;
}

/* 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;
    }
}