/* BlackCore Tech - Estilos Modulares */

html { 
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    opacity: 0;
    transition: opacity 0.5s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.loaded {
    opacity: 1;
}

/* Fix text alignment and container issues */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}

/* Smooth page transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Better logo alignment and sizing */
header a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 80px;
}

/* Logo glow effect */
header a img {
    transition: all 0.3s ease;
    will-change: transform, filter;
}

header a:hover img {
    filter: drop-shadow(0 0 25px rgba(0, 212, 255, 0.5)) drop-shadow(0 0 50px rgba(0, 212, 255, 0.2)) !important;
}

/* Optimize performance */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce layout shifts */
img {
    aspect-ratio: attr(width) / attr(height);
}

/* Services Dropdown Scroll */
#services-dropdown {
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) transparent;
    padding: 0.25rem 0 !important;
    font-size: 0.875rem;
}

/* Make dropdown items thinner and more elegant */
#services-dropdown a {
    padding: 0.375rem 1rem !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
}

#services-dropdown > div {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.7rem !important;
}

#services-dropdown::-webkit-scrollbar {
    width: 6px;
}

#services-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

#services-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 3px;
}

#services-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

/* Make dropdown items thinner and more elegant */
#services-dropdown a {
    padding: 0.375rem 1rem !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
}

/* Sticky category headers in dropdown - thinner */
#services-dropdown > div {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.7rem !important;
}

#services-dropdown > div:first-child {
    position: sticky;
    top: 0;
    background: #002342;
    z-index: 10;
    padding-top: 0.375rem !important;
    padding-bottom: 0.375rem !important;
}

/* WhatsApp Floating Button */
a[aria-label="Contactar por WhatsApp"] {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    a[aria-label="Contactar por WhatsApp"] {
        animation: none;
    }
}

/* Clients Carousel */
.clients-section {
    background: linear-gradient(135deg, #001529 0%, #002342 100%);
    padding: 4rem 0;
    overflow: hidden;
    position: relative;
}

.clients-section::before,
.clients-section::after {
    content: '';
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.clients-section::before {
    left: 0;
    background: linear-gradient(to right, #001529, transparent);
}

.clients-section::after {
    right: 0;
    background: linear-gradient(to left, #001529, transparent);
}

.clients-carousel-container {
    overflow: hidden;
    position: relative;
    width: 100%;
}

.clients-track {
    display: flex;
    animation: scroll-clients 30s linear infinite;
    gap: 4rem;
    align-items: center;
}

.clients-track:hover {
    animation-play-state: paused;
}

.client-logo-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 100px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.client-logo-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.client-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: grayscale(100%) opacity(0.7);
    transition: filter 0.3s ease;
}

.client-logo-item:hover .client-logo {
    filter: grayscale(0%) opacity(1);
}

@keyframes scroll-clients {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-33.333%);
    }
}

/* Responsive carousel */
@media (max-width: 768px) {
    .client-logo-item {
        width: 150px;
        height: 75px;
    }
    
    .clients-track {
        gap: 2rem;
    }
}

header img {
    max-height: 80px;
    min-height: 60px;
    width: auto;
    object-fit: contain;
    object-position: left center;
}

@media (min-width: 640px) {
    header img {
        max-height: 100px;
        min-height: 80px;
    }
}

@media (min-width: 768px) {
    header img {
        max-height: 120px;
        min-height: 100px;
    }
}

@media (min-width: 1024px) {
    header img {
        max-height: 140px;
        min-height: 120px;
    }
}

/* Brillo ajustado al nuevo azul */
.tech-glow { 
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.4); 
}

.glass-effect {
    background: rgba(0, 35, 66, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0, 212, 255, 0.25);
    border-color: #00d4ff;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Responsive improvements */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .section-padding {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .service-card {
        padding: 1.5rem !important;
    }
}

/* Blog Management Styles */
.blog-admin-panel {
    background: rgba(0, 35, 66, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.blog-form-input {
    background: rgba(0, 21, 41, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.blog-form-input:focus {
    border-color: #00d4ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Blog Card Animations */
.blog-card {
    transition: all 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px -10px rgba(0, 212, 255, 0.3);
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(0, 212, 255, 0.1);
    border-top: 3px solid #00d4ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #002342;
    color: #f1f5f9;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #00d4ff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Responsive Images with Smooth Rendering */
img {
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-quality;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    transition: all 0.3s ease;
}

/* Smooth image loading and transitions */
img[src] {
    filter: blur(0);
    animation: imageFadeIn 0.5s ease-in;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
        filter: blur(5px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Logo specific styles */
header img,
footer img {
    image-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Blog and hero images smooth effect */
.hero-pattern,
.blog-card img,
.service-card img,
.smooth-image {
    filter: brightness(1) contrast(1) saturate(1);
    transition: filter 0.3s ease, transform 0.5s ease;
    will-change: transform, filter;
}

.blog-card:hover img,
.service-card:hover img,
.smooth-image:hover {
    filter: brightness(1.05) contrast(1.05) saturate(1.1);
}

/* Smooth image loading with placeholder */
img:not([src]),
img[src=""] {
    background: linear-gradient(90deg, #001529 0%, #002342 50%, #001529 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Once image is loaded */
img[src]:not([src=""]) {
    background: none;
    animation: none;
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    button, a {
        min-height: 44px;
        min-width: 44px;
    }
}


/* Fix text alignment and overflow */
section {
    position: relative;
    overflow-x: hidden;
}

.service-card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#service-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#service-content > div {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Footer services grid */
#footer-services {
    display: grid !important;
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

@media (min-width: 640px) {
    #footer-services {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 768px) {
    #footer-services {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1024px) {
    #footer-services {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

#footer-services li {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
}

/* Mobile Services Menu - Scroll Fix */
#mobile-services-menu {
    max-height: 60vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 212, 255, 0.3) transparent !important;
}

#mobile-services-menu::-webkit-scrollbar {
    width: 6px !important;
}

#mobile-services-menu::-webkit-scrollbar-track {
    background: transparent !important;
}

#mobile-services-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3) !important;
    border-radius: 3px !important;
}

#mobile-services-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5) !important;
}

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