/* ========================================
   OCEAN THEME CSS - BUU Scholarship System (SAFE VERSION)
   ======================================== */

/* ========================================
   TOP BAR OCEAN THEME
   ======================================== */

/* Ocean Theme Top Bar */
.sb-topnav {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4facfe 100%) !important;
    border-bottom: 3px solid rgba(137, 247, 254, 0.3);
    box-shadow: 0 2px 10px rgba(0, 242, 254, 0.2);
    position: relative;
    overflow: hidden;
}

/* Ocean Wave Effect */
.sb-topnav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 242, 254, 0.4) 20%, 
        rgba(137, 247, 254, 0.8) 50%, 
        rgba(0, 242, 254, 0.4) 80%, 
        transparent 100%);
    animation: topWave 6s ease-in-out infinite;
}

@keyframes topWave {
    0% { transform: translateX(-100%); opacity: 0.6; }
    50% { transform: translateX(100%); opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0.6; }
}

/* Logo Enhancement */
.navbar-brand img {
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
    transition: all 0.3s ease;
}

.navbar-brand:hover img {
    filter: drop-shadow(0 4px 8px rgba(137, 247, 254, 0.5));
    transform: scale(1.05);
}

/* Sidebar Toggle Button */
.btn-link {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.3s ease;
}

.btn-link:hover {
    color: #89f7fe !important;
    transform: scale(1.1);
}

/* Search Bar Ocean Style */
.form-control {
    border: 2px solid rgba(137, 247, 254, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #00f2fe;
    box-shadow: 0 0 0 0.2rem rgba(0, 242, 254, 0.25);
    background: rgba(255, 255, 255, 0.15);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* Search Button */
.btn-primary {
    background: linear-gradient(45deg, #00f2fe, #4facfe);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 242, 254, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 242, 254, 0.4);
}

/* User Dropdown Ocean Style */
.dropdown-menu {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: 1px solid rgba(137, 247, 254, 0.3);
    box-shadow: 0 8px 32px rgba(0, 242, 254, 0.2);
    backdrop-filter: blur(10px);
    margin-top: 8px;
    z-index: 9999 !important;
    position: absolute !important;
}

/* Ensure dropdown menu is always on top */
.navbar-nav .dropdown-menu {
    z-index: 9999 !important;
    position: absolute !important;
}

.sb-topnav .dropdown-menu {
    z-index: 9999 !important;
    position: absolute !important;
}

/* Ensure dropdown container has proper positioning */
.nav-item.dropdown {
    position: relative;
    z-index: 9999;
}

/* Fix for any overlapping elements */
.sb-topnav {
    z-index: 1000;
    position: relative;
}

.dropdown-item {
    color: white;
    transition: all 0.3s ease;
    padding: 0.75rem 1.5rem;
    position: relative;
    z-index: 10000;
}

.dropdown-item:hover {
    background: rgba(137, 247, 254, 0.2);
    color: #89f7fe;
    transform: translateX(5px);
}

.dropdown-divider {
    border-color: rgba(137, 247, 254, 0.3);
    margin: 0.5rem 0;
}

/* User Icon */
.nav-link .fas.fa-user {
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.nav-link:hover .fas.fa-user {
    color: #89f7fe;
    transform: scale(1.1);
}

/* ========================================
   SIDEBAR OCEAN THEME
   ======================================== */

/* Ocean Theme Sidebar */
.sb-sidenav-dark {
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 50%, #4facfe 100%) !important;
    border-right: 3px solid rgba(137, 247, 254, 0.3);
    position: relative;
    overflow: hidden;
}

/* Ocean Wave Effect on Sidebar */
.sb-sidenav-dark::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(0, 242, 254, 0.4) 20%, 
        rgba(137, 247, 254, 0.8) 50%, 
        rgba(0, 242, 254, 0.4) 80%, 
        transparent 100%);
    animation: sideWave 8s ease-in-out infinite;
}

@keyframes sideWave {
    0% { transform: translateY(-100%); opacity: 0.6; }
    50% { transform: translateY(100%); opacity: 1; }
    100% { transform: translateY(-100%); opacity: 0.6; }
}

/* Nav Links Ocean Style */
.sb-sidenav-dark .nav-link {
    color: rgba(255, 255, 255, 0.9);
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sb-sidenav-dark .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(137, 247, 254, 0.2), transparent);
    transition: width 0.3s ease;
}

.sb-sidenav-dark .nav-link:hover {
    background: rgba(137, 247, 254, 0.15);
    border-left-color: #89f7fe;
    color: #89f7fe;
    transform: translateX(5px);
}

.sb-sidenav-dark .nav-link:hover::before {
    width: 100%;
}

/* Active State */
.sb-sidenav-dark .nav-link.active {
    background: rgba(137, 247, 254, 0.25);
    border-left-color: #00f2fe;
    color: #00f2fe;
    box-shadow: inset 0 0 20px rgba(0, 242, 254, 0.1);
}

/* Icons Enhancement */
.sb-nav-link-icon {
    color: rgba(137, 247, 254, 0.8);
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover .sb-nav-link-icon {
    color: #00f2fe;
    transform: scale(1.1);
}

.nav-link:hover .sb-nav-link-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(137, 247, 254, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: iconPulse 1s ease-in-out infinite;
}

@keyframes iconPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
}

/* Menu Headings */
.sb-sidenav-menu-heading {
    background: rgba(0, 242, 254, 0.1);
    border-left: 4px solid #00f2fe;
    color: #89f7fe !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.sb-sidenav-menu-heading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(137, 247, 254, 0.2), transparent);
    animation: headingShine 3s ease-in-out infinite;
}

@keyframes headingShine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Collapse Arrows */
.sb-sidenav-collapse-arrow {
    color: rgba(137, 247, 254, 0.6);
    transition: all 0.3s ease;
}

.nav-link:hover .sb-sidenav-collapse-arrow {
    color: #00f2fe;
    transform: rotate(180deg);
}

/* Nested Nav Links */
.sb-sidenav-menu-nested .nav-link {
    padding-left: 2.5rem;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
}

.sb-sidenav-menu-nested .nav-link:hover {
    border-left-color: rgba(137, 247, 254, 0.5);
    background: rgba(137, 247, 254, 0.1);
}

/* Footer Enhancement */
.sb-sidenav-footer {
    background: rgba(0, 242, 254, 0.1);
    border-top: 2px solid rgba(137, 247, 254, 0.3);
    position: relative;
    overflow: hidden;
}

.sb-sidenav-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(137, 247, 254, 0.1) 50%, 
        transparent 70%);
    animation: footerGlow 4s ease-in-out infinite;
}

@keyframes footerGlow {
    0% { opacity: 0.3; }
    50% { opacity: 0.8; }
    100% { opacity: 0.3; }
}

.sb-sidenav-footer .text-warning {
    color: #89f7fe !important;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.sb-sidenav-footer .small {
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

/* ========================================
   MAIN PAGE OCEAN THEME
   ======================================== */

/* Page Header Gradient - Ocean Theme */
.page-header-gradient {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 25%, #4facfe 50%, #00f2fe 75%, #89f7fe 100%);
    background-image: 
        linear-gradient(135deg, rgba(30, 60, 114, 0.95) 0%, rgba(42, 82, 152, 0.95) 25%, rgba(79, 172, 254, 0.95) 50%, rgba(0, 242, 254, 0.95) 75%, rgba(137, 247, 254, 0.95) 100%),
        url('https://science.buu.ac.th/scholarship/pic/bg_topic.png');
    background-size: cover;
    background-position: right center;
    background-repeat: no-repeat;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.page-header-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: url('https://science.buu.ac.th/scholarship/pic/bg_topic.png') no-repeat right center;
    background-size: cover;
    opacity: 0.2;
    z-index: 1;
}

/* Animated Light Effect - Ocean Wave */
.page-header-gradient::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 242, 254, 0.4) 20%, 
        rgba(137, 247, 254, 0.9) 50%, 
        rgba(0, 242, 254, 0.4) 80%, 
        transparent 100%);
    animation: oceanWave 4s ease-in-out infinite;
    z-index: 3;
}

@keyframes oceanWave {
    0% {
        transform: translateX(-100%);
        opacity: 0.6;
    }
    25% {
        opacity: 1;
    }
    50% {
        transform: translateX(100%);
        opacity: 1;
    }
    75% {
        opacity: 0.8;
    }
    100% {
        transform: translateX(-100%);
        opacity: 0.6;
    }
}

.page-header-gradient h2 {
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
    margin: 0;
    font-size: 2.2rem;
    line-height: 1.3;
}

/* ========================================
   CARD STYLES
   ======================================== */

/* News Cards */
.news-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.news-card .card-img-top {
    height: 250px;
    object-fit: cover;
    transition: all 0.3s ease;
}

.news-card:hover .card-img-top {
    transform: scale(1.05);
}

.news-card .card-body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::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 ease;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* ========================================
   SLIDER STYLES
   ======================================== */

/* Carousel Ocean Theme */
.carousel {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    position: relative;
}

/* เมื่อมีสไลด์เพียงภาพเดียว - ปิดการ slide */
.carousel.single-slide {
    pointer-events: none;
}

.carousel.single-slide .carousel-inner {
    transition: none;
}

.carousel-item img {
    height: 583px !important;
    object-fit: cover;
    object-position: center;
}

.carousel-control-prev,
.carousel-control-next {
    background: rgba(0, 242, 254, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    z-index: 10;
}

.carousel-control-prev {
    left: 20px;
}

.carousel-control-next {
    right: 20px;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: rgba(0, 242, 254, 0.6);
    transform: scale(1.1);
}

.carousel-indicators {
    bottom: 20px;
    z-index: 10;
}

.carousel-indicators [data-bs-target] {
    background-color: rgba(137, 247, 254, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    transition: all 0.3s ease;
}

.carousel-indicators [data-bs-target].active {
    background-color: #00f2fe;
    transform: scale(1.2);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    /* Top Bar Mobile */
    .sb-topnav::after {
        height: 1px;
    }
    
    .navbar-brand img {
        width: 140px !important;
    }
    
    .form-control {
        font-size: 0.9rem;
    }

    /* Sidebar Mobile */
    .sb-sidenav-dark::after {
        width: 1px;
    }
    
    .sb-sidenav-dark .nav-link:hover {
        transform: translateX(3px);
    }
    
    .sb-sidenav-menu-nested .nav-link {
        padding-left: 2rem;
        font-size: 0.85rem;
    }

    /* Page Header Mobile */
    .page-header-gradient {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .page-header-gradient::before {
        width: 40%;
        opacity: 0.15;
    }
    
    .page-header-gradient::after {
        height: 3px;
    }

    .page-header-gradient h2 {
        font-size: 1.8rem;
    }

    /* News Cards Mobile */
    .news-card .card-img-top {
        height: 200px;
    }

    /* Carousel Mobile */
    .carousel-item img {
        height: 583px !important;
        object-position: center;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
        margin: auto 10px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus States for Accessibility */
.sb-sidenav-dark .nav-link:focus {
    outline: 2px solid #00f2fe;
    outline-offset: -2px;
    background: rgba(137, 247, 254, 0.2);
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 242, 254, 0.25);
}

/* Smooth Scrollbar */
.sb-sidenav-menu {
    scrollbar-width: thin;
    scrollbar-color: rgba(137, 247, 254, 0.3) transparent;
}

.sb-sidenav-menu::-webkit-scrollbar {
    width: 6px;
}

.sb-sidenav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sb-sidenav-menu::-webkit-scrollbar-thumb {
    background: rgba(137, 247, 254, 0.3);
    border-radius: 3px;
}

.sb-sidenav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(137, 247, 254, 0.5);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-ocean-primary {
    color: #00f2fe !important;
}

.text-ocean-secondary {
    color: #89f7fe !important;
}

.bg-ocean-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
}

.bg-ocean-secondary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

.border-ocean {
    border-color: rgba(137, 247, 254, 0.3) !important;
}

.shadow-ocean {
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2) !important;
}

/* ========================================
   SIDEBAR ANIMATION OVERRIDE - DISABLE ALL ANIMATIONS
   ======================================== */

/* Disable all animations in sidebar to prevent scrollbar issues */
.sb-sidenav-dark::after {
    animation: none !important;
}

.sb-sidenav-dark .nav-link::before {
    animation: none !important;
}

.nav-link:hover .sb-nav-link-icon::after {
    animation: none !important;
}

.sb-sidenav-menu-heading::before {
    animation: none !important;
}

.sb-sidenav-footer::before {
    animation: none !important;
}

/* Disable all keyframe animations */
@keyframes sideWave {
    /* Disabled animation */
}

@keyframes iconPulse {
    /* Disabled animation */
}

@keyframes headingShine {
    /* Disabled animation */
}

@keyframes footerGlow {
    /* Disabled animation */
}

/* Additional override for any remaining animations */
.sb-sidenav * {
    animation: none !important;
}

.sb-sidenav *::before,
.sb-sidenav *::after {
    animation: none !important;
}

/* ========================================
   SWEETALERT2 CUSTOM STYLES
   ======================================== */

.swal2-title {
    font-family: 'kvl' !important;
    font-size: 20px;
    font-weight: bold;
}

.swal2-html-container {
    font-family: 'tt';
    font-size: 14px;
    color: #333;
}

.swal2-confirm, .swal2-cancel {
    font-family: 'kvl' !important;
    font-size: 15px;
    text-transform: uppercase;
}
