/* 
 * Frontend CSS - Empresas Bahamonde v2
 * Custom styles complementando Tailwind CSS
 */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Utility classes for animations */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.animate-pulse-slow {
    animation: pulse 3s ease-in-out infinite;
}

/* Gradient backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

.bg-gradient-dark {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* Hero carousel custom styles */
.hero-slide {
    position: relative;
    height: 100vh;
    background-size: cover;
    background-position: center;
}

.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6));
}

/* Card hover effects */
.service-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Map custom styles */
#map {
    width: 100%;
    min-height: 400px;
    border-radius: 1rem;
}

.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    padding: 12px !important;
}

.gm-style .gm-style-iw-d {
    overflow: auto !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #0ea5e9;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0369a1;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form input focus styles */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Alert notifications */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    animation: slideInDown 0.3s ease-out;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive utilities */
@media (max-width: 768px) {
    .hero-slide {
        height: 70vh;
    }
    
    #map {
        min-height: 300px;
    }
}

/* Client logos hover effect */
.client-logo {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.client-logo:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

/* Backdrop blur support */
@supports (backdrop-filter: blur(10px)) {
    .backdrop-blur-custom {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .no-print {
        display: none !important;
    }
}

/* Accessibility - Focus visible */
*:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Dark mode support (opcional para futuro) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}

/* Custom tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    margin-bottom: 0.5rem;
}

[data-tooltip]:hover::before {
    opacity: 1;
}

/* Image lazy loading placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Intersection Observer fade-in */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Blog Content Rich Text Styles (TinyMCE) */
.blog-content {
    max-width: 100%;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
}

.blog-content h1 {
    font-size: 2em;
    border-bottom: 3px solid #1eb716;
    padding-bottom: 0.5em;
}

.blog-content h2 {
    font-size: 1.75em;
    border-bottom: 2px solid #1eb716;
    padding-bottom: 0.4em;
}

.blog-content h3 {
    font-size: 1.5em;
    color: #1eb716;
}

.blog-content h4 {
    font-size: 1.25em;
}

.blog-content h5 {
    font-size: 1.1em;
}

.blog-content h6 {
    font-size: 1em;
}

.blog-content p {
    margin-bottom: 1em;
    line-height: 1.8;
    text-align: justify;
}

.blog-content p:first-child {
    font-size: 1.1em;
    font-weight: 500;
    color: #374151;
    text-align: left;
}

.blog-content strong,
.blog-content b {
    font-weight: 700;
    color: #1f2937;
}

.blog-content em,
.blog-content i {
    font-style: italic;
    color: #4b5563;
}

.blog-content a {
    color: #1eb716;
    text-decoration: none;
    border-bottom: 1px solid #1eb716;
    transition: all 0.3s ease;
}

.blog-content a:hover {
    color: #1a9f13;
    background-color: rgba(30, 183, 22, 0.1);
    padding: 0 2px;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1em;
    margin-left: 1.5em;
}

.blog-content ul {
    list-style-type: disc;
}

.blog-content ol {
    list-style-type: decimal;
}

.blog-content li {
    margin-bottom: 0.5em;
    line-height: 1.8;
}

.blog-content ul ul,
.blog-content ol ol,
.blog-content ul ol,
.blog-content ol ul {
    margin-top: 0.5em;
    margin-bottom: 0;
    margin-left: 1em;
}

.blog-content blockquote {
    margin: 1.5em 0;
    padding-left: 1.5em;
    border-left: 4px solid #1eb716;
    background-color: rgba(30, 183, 22, 0.05);
    color: #4b5563;
    font-style: italic;
    font-size: 1.05em;
    line-height: 1.8;
}

.blog-content blockquote p {
    margin-bottom: 0.5em;
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5em 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: block;
}

.blog-content code {
    background-color: #f3f4f6;
    color: #dc2626;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.blog-content pre {
    background-color: #1f2937;
    color: #f3f4f6;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
    line-height: 1.5;
}

.blog-content pre code {
    background-color: transparent;
    color: #f3f4f6;
    padding: 0;
    border-radius: 0;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.blog-content table th {
    background-color: #1eb716;
    color: white;
    padding: 0.75em;
    text-align: left;
    font-weight: 700;
}

.blog-content table td {
    padding: 0.75em;
    border-bottom: 1px solid #e5e7eb;
}

.blog-content table tr:hover {
    background-color: rgba(30, 183, 22, 0.05);
}

.blog-content table tr:last-child td {
    border-bottom: none;
}

.blog-content hr {
    margin: 2em 0;
    border: none;
    border-top: 2px solid #1eb716;
}

.blog-content sup,
.blog-content sub {
    font-size: 0.8em;
    line-height: 1;
}

.blog-content sup {
    vertical-align: super;
}

.blog-content sub {
    vertical-align: sub;
}

.blog-content mark {
    background-color: rgba(30, 183, 22, 0.2);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.blog-content del {
    text-decoration: line-through;
    color: #9ca3af;
}
