/* ==========================================================================
   Presidencia Municipal de Hidalgo del Parral - Sistema de Diseño
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABLES CSS - Paleta de Colores Institucional
   -------------------------------------------------------------------------- */
:root {
    /* Colores Primarios */
    --primary: #001A57;
    --primary-light: #002b7f;
    --primary-dark: #00103a;

    /* Colores Secundarios (Gradiente) */
    --secondary-teal: #3B9C9C;
    --secondary-magenta: #C2185B;
    --gradient: linear-gradient(135deg, var(--secondary-teal), var(--secondary-magenta));
    --gradient-hover: linear-gradient(135deg, #2d7a7a, #9c1349);

    /* Fondos */
    --bg-light: #FFFFFF;
    --bg-cream: #FAFAFA;
    --bg-gray: #F5F5F5;

    /* Texto */
    --text-dark: #1A1A2E;
    --text-muted: #6C757D;
    --text-light: #FFFFFF;

    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 26, 87, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 26, 87, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 26, 87, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 26, 87, 0.20);

    /* Bordes */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 32px;

    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Tipografía */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', var(--font-primary);
}

/* --------------------------------------------------------------------------
   2. RESET Y BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--secondary-teal);
}

img {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   3. NAVBAR
   -------------------------------------------------------------------------- */
.navbar-parral {
    background: var(--primary) !important;
    padding: 0.75rem 0;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-medium);
}

.navbar-parral.scrolled {
    padding: 0.5rem 0;
    box-shadow: var(--shadow-lg);
}

.navbar-brand-parral {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-brand-parral img {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

.navbar-brand-parral span {
    color: var(--text-light);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.navbar-parral .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    position: relative;
    transition: color var(--transition-fast);
}

.navbar-parral .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient);
    transition: all var(--transition-medium);
    transform: translateX(-50%);
}

.navbar-parral .nav-link:hover,
.navbar-parral .nav-link.active {
    color: var(--text-light) !important;
}

.navbar-parral .nav-link:hover::after,
.navbar-parral .nav-link.active::after {
    width: 80%;
}

.navbar-search {
    position: relative;
}

.navbar-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-xl);
    color: var(--text-light);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    width: 200px;
    transition: all var(--transition-medium);
}

.navbar-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.navbar-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary-teal);
    outline: none;
    width: 250px;
}

.navbar-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
}

.social-icons a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-left: 0.75rem;
    transition: all var(--transition-fast);
}

.social-icons a:hover {
    color: var(--secondary-teal);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   4. HERO SECTION
   -------------------------------------------------------------------------- */
.hero-section {
    position: relative;
    height: 85vh;
    min-height: 600px;
    overflow: hidden;
}

.hero-carousel .carousel-item {
    height: 85vh;
    min-height: 600px;
}

.hero-carousel .carousel-item img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    filter: brightness(0.7);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            rgba(0, 26, 87, 0.3) 0%,
            rgba(0, 26, 87, 0.6) 100%);
    z-index: 1;
}

.hero-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
    width: 90%;
    max-width: 800px;
}

.hero-content h1 {
    color: var(--text-light);
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin-bottom: 2rem;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   5. BOTONES
   -------------------------------------------------------------------------- */
.btn-gradient {
    background: var(--gradient);
    border: none;
    color: var(--text-light);
    padding: 0.875rem 2rem;
    border-radius: var(--border-radius-xl);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.5s;
}

.btn-gradient:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: var(--text-light);
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-outline-light-custom {
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: var(--text-light);
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-xl);
    font-weight: 600;
    background: transparent;
    transition: all var(--transition-medium);
}

.btn-outline-light-custom:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--text-light);
    color: var(--text-light);
    transform: translateY(-3px);
}

.btn-primary-parral {
    background: var(--primary);
    border: none;
    color: var(--text-light);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-medium);
}

.btn-primary-parral:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-light);
}

/* --------------------------------------------------------------------------
   6. SECCIONES
   -------------------------------------------------------------------------- */
.section {
    padding: 5rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient);
    border-radius: 2px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 1.5rem auto 0;
}

.section-gray {
    background: var(--bg-gray);
}

/* --------------------------------------------------------------------------
   7. CARDS DE TURISMO
   -------------------------------------------------------------------------- */
.card-turismo {
    border: none;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
    height: 100%;
}

.card-turismo:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.card-turismo .card-img-wrapper {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.card-turismo .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card-turismo:hover .card-img-wrapper img {
    transform: scale(1.1);
}

.card-turismo .card-img-overlay-custom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 26, 87, 0.9), transparent);
    padding: 2rem 1.5rem 1rem;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.card-turismo:hover .card-img-overlay-custom {
    opacity: 1;
}

.card-turismo .card-img-overlay-custom p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
}

.card-turismo .card-body {
    padding: 1.5rem;
}

.card-turismo .card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-turismo .card-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.card-turismo .btn-link-parral {
    color: var(--secondary-teal);
    font-weight: 600;
    padding: 0;
    transition: color var(--transition-fast);
}

.card-turismo .btn-link-parral:hover {
    color: var(--secondary-magenta);
}

/* --------------------------------------------------------------------------
   8. ACCESOS RÁPIDOS (ADMINISTRACIÓN)
   -------------------------------------------------------------------------- */
.quick-access-card {
    background: var(--bg-light);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
    height: 100%;
    border: 2px solid transparent;
}

.quick-access-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-teal);
}

.quick-access-card .icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--secondary-teal);
    /* Update to solid color */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
    /* Enable background transition */
}

.quick-access-card:hover .icon-wrapper {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(0.85);
    /* Darken on hover */
}

.quick-access-card .icon-wrapper i {
    font-size: 2rem;
    color: var(--text-light);
}

.quick-access-card h5 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.quick-access-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   9. NOTICIAS
   -------------------------------------------------------------------------- */
.news-card {
    border: none;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
}

.news-card:hover {
    box-shadow: var(--shadow-lg);
}

.news-card .news-img {
    height: 200px;
    object-fit: cover;
}

.news-card .card-body {
    padding: 1.5rem;
}

.news-card .news-date {
    color: var(--secondary-teal);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.news-card .card-title {
    font-size: 1.1rem;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   10. SEMANARIO / FLIPBOOK
   -------------------------------------------------------------------------- */
.semanario-section {
    background: linear-gradient(135deg, var(--bg-gray) 0%, var(--bg-cream) 100%);
}

.edition-selector {
    background: var(--bg-light);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.edition-selector label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.edition-selector select {
    border: 2px solid var(--bg-gray);
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.edition-selector select:focus {
    border-color: var(--secondary-teal);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 156, 156, 0.2);
}

/* Flipbook Container */
.flipbook-container {
    perspective: 2000px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    min-height: 500px;
}

.flipbook {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/11;
    transform-style: preserve-3d;
}

.flipbook-page {
    position: absolute;
    width: 50%;
    height: 100%;
    top: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    cursor: pointer;
}

.flipbook-page.left {
    left: 0;
    transform-origin: right center;
    z-index: 1;
}

.flipbook-page.right {
    left: 50%;
    z-index: 2;
}

.flipbook-page.flipping {
    z-index: 10;
}

.flipbook-page-front,
.flipbook-page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.flipbook-page-front {
    background: var(--bg-light);
}

.flipbook-page-back {
    background: var(--bg-light);
    transform: rotateY(180deg);
}

.flipbook-page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Flipbook Wrapper for proper layout */
.flipbook-wrapper {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: var(--border-radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.flipbook-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 90%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

/* Simplified Flipbook for two-page spread */
.flipbook-spread {
    display: flex;
    justify-content: center;
    gap: 4px;
    perspective: 2000px;
}

.flipbook-spread .page {
    flex: 1;
    max-width: 400px;
    aspect-ratio: 8.5/11;
    background: var(--bg-light);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: transform var(--transition-medium);
}

.flipbook-spread .page:hover {
    transform: translateY(-5px);
}

.flipbook-spread .page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Flipbook Controls */
.flipbook-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.flipbook-controls button {
    background: var(--primary);
    border: none;
    color: var(--text-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-medium);
}

.flipbook-controls button:hover:not(:disabled) {
    background: var(--gradient);
    transform: scale(1.1);
}

.flipbook-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flipbook-controls .page-indicator {
    font-weight: 600;
    color: var(--primary);
    min-width: 100px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   11. FOOTER
   -------------------------------------------------------------------------- */
.footer-parral {
    background: var(--primary);
    color: var(--text-light);
    padding-top: 4rem;
}

.footer-parral h5 {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.footer-parral h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--gradient);
    border-radius: 2px;
}

.footer-parral p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-parral ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-parral ul li {
    margin-bottom: 0.75rem;
}

.footer-parral ul li a {
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-parral ul li a:hover {
    color: var(--secondary-teal);
    transform: translateX(5px);
}

.footer-parral .contact-info li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.footer-parral .contact-info i {
    color: var(--secondary-teal);
    margin-top: 0.25rem;
}

.footer-bottom {
    background: var(--primary-dark);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 1rem;
    margin-left: 0.5rem;
    transition: all var(--transition-medium);
}

.footer-social a:hover {
    background: var(--gradient);
    transform: translateY(-3px);
}

/* --------------------------------------------------------------------------
   12. UTILIDADES
   -------------------------------------------------------------------------- */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    position: relative;
    border: none;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: var(--gradient);
    border-radius: inherit;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.bg-gradient-parral {
    background: var(--gradient);
}

.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --------------------------------------------------------------------------
   13. ANIMACIONES
   -------------------------------------------------------------------------- */
@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 pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.4s ease forwards;
}

/* --------------------------------------------------------------------------
   14. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .navbar-parral .navbar-collapse {
        background: var(--primary);
        padding: 1rem;
        border-radius: var(--border-radius-md);
        margin-top: 1rem;
    }

    .navbar-search {
        margin-top: 1rem;
    }

    .navbar-search input {
        width: 100%;
    }

    .navbar-search input:focus {
        width: 100%;
    }

    .hero-section,
    .hero-carousel .carousel-item {
        height: 70vh;
        min-height: 500px;
    }

    .flipbook-spread {
        flex-direction: column;
        align-items: center;
    }

    .flipbook-spread .page {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .section {
        padding: 3rem 0;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .hero-cta .btn {
        width: 100%;
        max-width: 280px;
    }

    .card-turismo .card-img-wrapper {
        height: 200px;
    }

    .flipbook-wrapper {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {

    .hero-section,
    .hero-carousel .carousel-item {
        height: 60vh;
        min-height: 400px;
    }

    .navbar-brand-parral span {
        font-size: 0.9rem;
    }

    .quick-access-card {
        padding: 1.5rem;
    }

    .quick-access-card .icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .quick-access-card .icon-wrapper i {
        font-size: 1.5rem;
    }
}

/* --------------------------------------------------------------------------
   15. PRINT STYLES
   -------------------------------------------------------------------------- */
@media print {

    .navbar-parral,
    .footer-parral,
    .flipbook-controls,
    .hero-carousel .carousel-control-prev,
    .hero-carousel .carousel-control-next {
        display: none !important;
    }

    .section {
        padding: 2rem 0;
    }
}