:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --accent-color: #85c1e2;
    --light-bg: #f8f9fa;
    --text-dark: #333333;
    --text-light: #666666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fix horizontal overflow - mencegah scroll horizontal di mobile */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: #fff;
    position: relative;
}

/* Fix untuk semua container agar tidak overflow */
.container, .container-fluid, section, header, footer, main, .row {
    max-width: 100%;
}

/* Navbar */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
}

.navbar-brand span {
    color: var(--primary-color);
    font-weight: 700;
}

.nav-link {
    color: var(--text-dark) !important;
    font-weight: 500;
    margin: 0 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    border-bottom: 3px solid var(--primary-color);
}

/* Running Text */
.running-text {
    background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
    padding: 10px 0;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}

.ticker {
    display: inline-block;
    animation: scroll 20s linear infinite;
    white-space: nowrap;
    padding-left: 100%;
}

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

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0;
    position: relative;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    align-items: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="5" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="3" fill="rgba(255,255,255,0.1)"/></svg>');
    z-index: 1;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.hero-section .lead {
    font-size: 1.25rem;
    margin-bottom: 30px;
}

/* Cards */
.card {
    transition: all 0.3s ease;
    border-radius: 8px;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

.card img {
    height: 250px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.card-title {
    color: var(--text-dark);
    font-size: 1.1rem;
    line-height: 1.4;
}

.badge {
    font-size: 0.75rem;
    padding: 5px 10px;
}

/* Buttons */
.btn {
    border-radius: 5px;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 95, 74, 0.3);
}

.btn-warning {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-weight: 700;
}

.btn-warning:hover {
    background-color: #e8860f;
    border-color: #e8860f;
}

/* Sections */
section {
    padding: 60px 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--primary-color);
}

/* Statistik Cards */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 15px 0;
}

.stat-card p {
    color: var(--text-light);
    font-weight: 500;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #eee;
    margin-top: auto;
}

footer h5 {
    color: white;
    font-weight: 700;
    margin-bottom: 20px;
}

footer a {
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
}

footer a:hover {
    color: white;
}

footer ul li {
    margin-bottom: 10px;
}

footer .social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    margin-right: 10px;
}

footer .social-links a:hover {
    background: var(--primary-color);
}

/* Pagination */
.pagination {
    margin-top: 40px;
}

.pagination .page-link {
    color: var(--primary-color);
    border-color: #ddd;
}

.pagination .page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Breadcrumb */
.breadcrumb {
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.breadcrumb-item a {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-light);
}

/* Modal */
.modal-header {
    background: var(--primary-color);
    color: white;
    border: none;
}

.modal-body {
    padding: 30px;
}

/* Border Left Styles */
.border-left-primary {
    border-left: 4px solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 4px solid #28a745 !important;
}

.border-left-warning {
    border-left: 4px solid #ffc107 !important;
}

.border-left-info {
    border-left: 4px solid #17a2b8 !important;
}

/* Utilities */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.hover-shadow-lg {
    transition: box-shadow 0.3s ease;
}

.hover-shadow-lg:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.15) !important;
}

.transition {
    transition: all 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    /* Fix overflow pada mobile */
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
        max-width: 100%;
    }
    
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .row > * {
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .lead {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    .btn {
        display: none;
    }

    .container {
        max-width: 100%;
    }
}

/* ============================================
   PHOTO & IMAGE ANIMATIONS
   ============================================ */

/* Image Container with overflow hidden for zoom effects */
.img-animate-container {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

/* Zoom on hover */
.img-hover-zoom {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                filter 0.4s ease;
    will-change: transform;
}

.img-hover-zoom:hover {
    transform: scale(1.08);
}

/* Brightness on hover */
.img-hover-bright:hover {
    filter: brightness(1.1) contrast(1.05);
}

/* Card image effects */
.card .card-img-top,
.card img.img-fluid,
.umkm-card img,
.umkm-logo img,
.umkm-detail-image img,
.kartar-card img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                filter 0.4s ease,
                opacity 0.4s ease;
    will-change: transform;
}

.card:hover .card-img-top,
.card:hover img.img-fluid,
.umkm-card:hover img,
.umkm-card:hover .umkm-logo img,
.kartar-card:hover img {
    transform: scale(1.08);
    filter: brightness(1.05);
}

/* Fade-in from bottom animation for images on scroll */
.img-fade-in {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.img-fade-in.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Shimmer loading placeholder */
.img-shimmer {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Pulse glow effect on photo cards */
.img-glow {
    transition: box-shadow 0.4s ease;
}

.img-glow:hover {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3),
                0 0 40px rgba(52, 152, 219, 0.1);
}

/* Rotate-in animation */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate3d(0, 0, 1, -10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate3d(0, 0, 1, 0deg) scale(1);
    }
}

.img-rotate-in {
    animation: rotateIn 0.8s ease-out forwards;
}

/* Slide-in from left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide-in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale-up entrance */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.img-scale-up {
    opacity: 0;
    animation: scaleUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Float animation for hero images */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.img-float {
    animation: float 3s ease-in-out infinite;
}

/* Ken Burns effect for background images */
@keyframes kenBurns {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.img-ken-burns {
    animation: kenBurns 20s ease-in-out infinite;
}

/* Overlay effect on hover */
.img-overlay-container {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.img-overlay-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.5) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.img-overlay-container:hover::after {
    opacity: 1;
}

/* Tilt effect on hover */
.card-tilt {
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateY(5deg) rotateX(2deg);
}

/* Image reveal from clip-path */
@keyframes clipReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.img-clip-reveal {
    animation: clipReveal 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Bounce in effect */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.img-bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Staggered grid animation */
.stagger-grid > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-grid > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-grid > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-grid > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-grid > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-grid > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-grid > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-grid > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-grid > *:nth-child(9) { animation-delay: 0.9s; }

/* Photo frame decoration */
.img-framed {
    border: 3px solid transparent;
    border-image: linear-gradient(135deg, var(--primary-color), var(--accent-color)) 1;
    padding: 4px;
    transition: all 0.4s ease;
}

.img-framed:hover {
    border-image: linear-gradient(135deg, var(--accent-color), var(--primary-color)) 1;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.25);
}

/* Lightbox cursor for images */
.img-lightbox-trigger {
    cursor: zoom-in;
}

/* Image upload preview animation */
.img-preview-animate {
    animation: scaleUp 0.5s ease forwards;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Spin-in for profile/avatar images */
@keyframes spinIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.img-spin-in {
    animation: spinIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Responsive image animations */
@media (prefers-reduced-motion: reduce) {
    .img-hover-zoom:hover,
    .card:hover .card-img-top,
    .card:hover img.img-fluid,
    .umkm-card:hover img,
    .kartar-card:hover img {
        transform: none;
    }
    
    .img-fade-in,
    .img-scale-up,
    .img-rotate-in,
    .img-bounce-in,
    .img-clip-reveal,
    .img-spin-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
    
    .img-float,
    .img-ken-burns {
        animation: none;
    }
}

/* ============================================
   IMAGE LIGHTBOX MODAL
   ============================================ */
.image-lightbox {
    display: none;
    position: fixed;
    z-index: 10000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    animation: fadeInLightbox 0.3s ease;
}

.image-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 5px;
    animation: zoomInLightbox 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-lightbox .lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001;
    transition: transform 0.3s ease;
    background: rgba(255,255,255,0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox .lightbox-close:hover {
    transform: rotate(90deg);
    background: rgba(255,255,255,0.2);
}

@keyframes fadeInLightbox {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomInLightbox {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============================================
   IMAGE PREVIEW IN FORMS
   ============================================ */
.upload-preview-container {
    position: relative;
    display: inline-block;
    margin-top: 10px;
    margin-bottom: 10px;
}

.upload-preview-container img {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: scaleUp 0.5s ease forwards;
}

.upload-preview-container .remove-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.upload-preview-container .remove-preview:hover {
    background: #c0392b;
    transform: scale(1.1);
}