/* Custom Styles for PIQCS Website */

/* Custom color variables */
:root {
    --primary-color: #16288d;
    /* Navbar color can be overridden independently */
    --navbar-color: var(--primary-color);
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gradient-primary: linear-gradient(135deg, #16288d 0%, #0f1d60 100%);
    --gradient-secondary: linear-gradient(135deg, #16288d 0%, #2d4db8 100%);
}

/* Global Styles */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

/* Headings with modern font */
h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
}

/* Section headers with gradient underline */
h2, h3 {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

/* Navigation Styles */
.navbar.bg-primary {
    background-color: var(--navbar-color) !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    color: #fff !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    color: #fff !important;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
    color: #fff !important;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}

.navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:active {
    background-color: var(--navbar-color);
}

/* Hero Section */
.hero-section {
    background: var(--gradient-primary);
    min-height: 40vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 3rem 0;
}

.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"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(10px, 10px); }
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-icon {
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.hero-section .badge {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.hero-section .badge:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.bg-gradient-primary {
    background: var(--gradient-primary) !important;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: #fff;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 1rem 3rem rgba(22, 40, 141, 0.15) !important;
}

.card-header {
    border-radius: 1rem 1rem 0 0 !important;
    border: none;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
}

/* Enhanced card styles for team members */
.card.h-100.shadow-sm.text-center {
    position: relative;
    overflow: hidden;
}

.card.h-100.shadow-sm.text-center::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card.h-100.shadow-sm.text-center:hover::before {
    transform: scaleX(1);
}

.card.h-100.shadow-sm.text-center:hover .bg-primary {
    transform: scale(1.1);
    box-shadow: 0 0.5rem 1rem rgba(22, 40, 141, 0.3);
}

/* Progress bars */
.progress {
    height: 0.5rem;
    border-radius: 0.5rem;
}

.progress-bar {
    border-radius: 0.5rem;
}

/* Badge Styles */
.badge {
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Work package card headers with enhanced styling */
.card-header.bg-primary,
.card-header.bg-info,
.card-header.bg-success,
.card-header.bg-warning {
    position: relative;
    overflow: hidden;
}

.card-header.bg-primary::after,
.card-header.bg-info::after,
.card-header.bg-success::after,
.card-header.bg-warning::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.card:hover .card-header::after {
    top: -100%;
    right: -100%;
}

/* Button Styles */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.625rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}

/* Themed buttons */
.btn {
    /* Ensure button labels have strong contrast on light backgrounds */
    color: #000 !important;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff !important; /* ensure white text on dark primary */
}

/* Hover fallback using the darker gradient endpoint for wide browser support */
.btn-primary:hover {
    background-color: #0f1d60;
    border-color: #0f1d60;
    color: #fff !important;
}

.btn-outline-primary {
    /* Outline buttons keep the brand border but use black text for contrast */
    color: #000 !important;
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: #fff !important;
    border-color: var(--primary-color);
}

/* List Styles */
.list-unstyled li {
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    padding-left: 0.5rem;
}

.list-unstyled li:hover {
    transform: translateX(5px);
    color: var(--primary-color);
}

.list-unstyled li i {
    transition: all 0.3s ease;
}

.list-unstyled li:hover i {
    transform: scale(1.2);
}

/* Icon Styles */
.bi {
    vertical-align: -0.125em;
}

/* Team member cards */
.card .bg-secondary,
.card .bg-primary {
    transition: all 0.3s ease;
}

/* Override Bootstrap utility classes to use theme variables */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.card:hover .bg-secondary {
    background-color: var(--primary-color) !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tab Content Animation */
.tab-pane {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Footer Styles */
footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 35vh;
        padding: 2rem 0;
        text-align: center;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .hero-section .col-lg-4 {
        margin-top: 2rem;
    }
    
    .navbar-nav .nav-link {
        margin: 0.25rem 0;
    }
}

/* Custom utility classes */
.shadow-sm {
    box-shadow: 0 0.125rem 0.5rem rgba(22, 40, 141, 0.08) !important;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main content area spacing */
main.container {
    background: transparent;
    position: relative;
}

main.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(22, 40, 141, 0.02) 0%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

main .tab-content > .tab-pane {
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgba(22, 40, 141, 0.05);
    margin-bottom: 2rem;
}

/* Loading animation for future use */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Page load fade-in effect */
body {
    animation: fadeInPage 0.5s ease-in;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Improved text readability */
p {
    line-height: 1.8;
    font-weight: 400;
    color: #3a3a3a;
}

.lead {
    font-weight: 400;
    line-height: 1.7;
}

/* Hero section specific styling for better contrast */
.hero-section .lead {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Institution logo containers */
.card img.img-fluid {
    transition: all 0.4s ease;
    filter: grayscale(0%);
}

.card:hover img.img-fluid {
    transform: scale(1.05);
    filter: grayscale(0%) drop-shadow(0 5px 15px rgba(22, 40, 141, 0.2));
}

/* Profile icons and images in team cards */
.bg-primary.rounded-circle {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .bg-primary.rounded-circle {
    background: var(--gradient-primary) !important;
}

/* Profile images styling */
.card img.rounded-circle {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #f8f9fa;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card:hover img.rounded-circle {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 8px 16px rgba(22, 40, 141, 0.2);
}

/* News card styling */
.news-item {
    position: relative;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.news-item:hover {
    border-left-color: var(--primary-color);
}

.news-item[data-highlight="true"] {
    border-left-color: #ffc107;
}

.news-item[data-highlight="true"]::before {
    content: 'HIGHLIGHTED';
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ffc107;
    color: #000;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    letter-spacing: 0.5px;
}

/* Focus styles for accessibility */
.nav-link:focus,
.btn:focus,
.card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 1px solid var(--dark-color);
    }
    
    .hero-section {
        background: var(--dark-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-icon {
        animation: none;
    }
}

/* Bootstrap Tab Functionality (CSS-only fallback) */
.tab-content .tab-pane {
    display: none;
}

.tab-content .tab-pane.active.show {
    display: block;
}

/* Bootstrap-like navigation styling */
.nav-pills .nav-link {
    background: none;
    border: none;
    color: #6c757d;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    margin-right: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
}

.nav-pills .nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: translateX(-50%);
    transition: width 0.3s ease;
    border-radius: 3px 3px 0 0;
}

.nav-pills .nav-link:hover {
    background: linear-gradient(135deg, rgba(22, 40, 141, 0.05) 0%, rgba(22, 40, 141, 0.1) 100%);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-pills .nav-link:hover::before {
    width: 80%;
}

.nav-pills .nav-link.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 0.25rem 1rem rgba(22, 40, 141, 0.3);
}

.nav-pills .nav-link.active::before {
    width: 0;
}

/* Navigation list styling */
.nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.nav-item {
    display: list-item;
}

/* Tab list styling */
.nav[role="tablist"] button {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.navbar-nav .nav-link.active {
    background-color: #0d6efd;
    color: #f8ffff;
    font-weight: 600;
}
