/* Modern Academic Website Styles */

/* Ensure Bootstrap Icons are always visible */
.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
    vertical-align: -0.125em;
}

/* Ensure icons with text utility classes are visible */
.bi.text-warning,
.bi.text-muted,
.bi.text-success,
.bi.text-primary,
.bi.text-secondary {
    display: inline-block !important;
    font-style: normal !important;
}

/* Ensure icons in card-body are visible */
.card-body .bi,
.card-body [class^="bi-"],
.card-body [class*=" bi-"] {
    display: inline-block !important;
}

/* Skip link styling for accessibility */
.visually-hidden-focusable {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:focus {
    position: fixed !important;
    width: auto !important;
    height: auto !important;
    padding: 0.5rem 1rem !important;
    margin: 0.5rem !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    z-index: 10000 !important;
    background: var(--primary) !important;
    color: white !important;
}

:root {
    /* Portland State University Brand Colors */
    --primary: #154734; /* PSU Green */
    --primary-light: #2d6b4f;
    --primary-dark: #0f3326;
    --secondary: #64748b;
    --accent: #D1A10D; /* PSU Gold */
    --accent-dark: #b0880a;
    --text: #0f172a;
    --text-light: #334155;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #cbd5e1;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease;
}

/* Dark mode color scheme */
[data-theme="dark"] {
    --primary: #4ade80; /* Lighter green for dark mode */
    --primary-light: #6ee7b7;
    --primary-dark: #22c55e;
    --text: #ffffff;
    --text-light: #e2e8f0;
    --bg: #1e293b;
    --bg-alt: #0f172a;
    --border: #475569;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* Respect system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #4ade80;
        --primary-light: #6ee7b7;
        --primary-dark: #22c55e;
        --text: #ffffff;
        --text-light: #e2e8f0;
        --bg: #1e293b;
        --bg-alt: #0f172a;
        --border: #475569;
        --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: var(--text);
    line-height: 1.6;
    background-color: var(--bg-alt);
    padding-top: 50px; /* Offset for fixed navbar */
}

/* High contrast links */
a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

[data-theme="dark"] a {
    color: var(--primary);
}

[data-theme="dark"] a:hover {
    color: var(--primary-light);
}

/* Navigation */
.navbar {
    background: var(--bg);
    border-bottom: 3px solid var(--accent);
    box-shadow: var(--shadow);
    padding: 0.5rem 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary) !important;
    transition: color 0.3s ease;
}

.navbar-toggler {
    border: 2px solid var(--primary);
    border-radius: 4px;
    padding: 0.375rem 0.5rem;
    color: var(--primary);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(21, 71, 52, 0.25);
    outline: none;
}

.navbar-toggler-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.navbar-toggler-icon i {
    font-size: 1.25rem;
    color: var(--primary);
    display: block;
}

[data-theme="dark"] .navbar-toggler {
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(110, 231, 183, 0.4);
}

[data-theme="dark"] .navbar-toggler-icon i {
    color: var(--primary);
}

.nav-link {
    color: var(--text) !important;
    font-weight: 500;
    margin: 0 0.25rem;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background-color: rgba(21, 71, 52, 0.1);
    border-radius: 4px;
}

[data-theme="dark"] .nav-link {
    color: var(--text) !important;
}

[data-theme="dark"] .nav-link:hover, 
[data-theme="dark"] .nav-link.active {
    background-color: rgba(74, 222, 128, 0.2);
    color: var(--primary) !important;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--accent);
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

.hero-image {
    display: block;
    margin: 0 auto;
}

.hero-content {
    min-width: 0; /* Prevent flex item from overflowing */
}

.hero::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
    pointer-events: none;
}

.btn-social {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-social:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-2px);
}

/* Border utilities */
.border-start-4 {
    border-left-width: 4px !important;
}

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

/* Hover effects */
.transition-hover {
    transition: var(--transition);
}

.transition-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md) !important;
}

.hover-bg-light:hover {
    background-color: var(--bg-alt);
}

/* Badges */
.badge {
    font-weight: 600;
    border-width: 1px;
    white-space: normal;
    word-wrap: break-word;
    display: inline-block;
    max-width: 100%;
}

@media (max-width: 768px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

.bg-light {
    background-color: var(--bg-alt) !important;
    color: var(--text) !important;
}

.badge.bg-light {
    border-color: var(--border) !important;
    color: var(--text) !important;
}

/* Section Header */
.section-header {
    font-weight: 700;
    color: var(--primary);
    position: relative;
}

/* Custom button styles */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-width: 2px;
    font-weight: 500;
}

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

.btn-outline-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(21, 71, 52, 0.25);
}

[data-theme="dark"] .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-width: 2px;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: var(--primary);
    color: #000000;
    border-color: var(--primary);
}

[data-theme="dark"] .btn-outline-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(110, 231, 183, 0.4);
}

[data-theme="dark"] .btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #000000;
    font-weight: 600;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: #000000;
}

/* Dark mode specific adjustments */
[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-top-color: var(--primary);
}

[data-theme="dark"] .btn-social {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn-social:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.card-header.bg-primary {
    background-color: var(--primary) !important;
    color: #ffffff !important;
}

.card-header.bg-primary h3,
.card-header.bg-primary h4,
.card-header.bg-primary h5 {
    color: #ffffff !important;
    font-weight: 700;
}

[data-theme="dark"] .card-header.bg-primary {
    background-color: #334155 !important;
    color: var(--text) !important;
    border-bottom: 2px solid var(--primary);
}

[data-theme="dark"] .card-header.bg-primary h3,
[data-theme="dark"] .card-header.bg-primary h4,
[data-theme="dark"] .card-header.bg-primary h5 {
    color: var(--text) !important;
}

.card-header.bg-accent {
    background-color: var(--accent) !important;
    color: #000000 !important;
}

.card-header.bg-accent h3,
.card-header.bg-accent h4,
.card-header.bg-accent h5 {
    color: #000000 !important;
    font-weight: 700;
}

[data-theme="dark"] .card-header.bg-accent {
    background-color: #475569 !important;
    color: var(--text) !important;
    border-bottom: 2px solid var(--accent);
}

[data-theme="dark"] .card-header.bg-accent h3,
[data-theme="dark"] .card-header.bg-accent h4,
[data-theme="dark"] .card-header.bg-accent h5 {
    color: var(--text) !important;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 2rem 0;
    background: var(--bg);
    color: var(--text);
}

footer a {
    color: var(--primary);
    font-weight: 500;
}

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

footer a:hover {
    text-decoration: underline;
}

/* Dark mode toggle button */
.theme-toggle {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    min-width: 40px;
}

.theme-toggle:hover {
    background: var(--primary);
    color: var(--bg);
}

.theme-toggle:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 991px) {
    /* Fix overlap at medium breakpoints (tablet) */
    .hero .row {
        flex-direction: column;
        align-items: center !important;
    }
    
    .hero .col-md-3 {
        margin-bottom: 2rem;
        width: 100%;
        max-width: 200px;
    }
    
    .hero .col-md-9 {
        width: 100%;
        text-align: center;
    }
    
    .hero img {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .hero {
        padding: 2rem 1.5rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero .lead {
        font-size: 1rem;
    }
    
    .btn-social {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .section-header {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .display-5 {
        font-size: 1.75rem;
    }
    
    /* Stack social links on mobile */
    .social-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-social {
        width: 100%;
        justify-content: center;
    }
    
    /* Adjust hero image on mobile */
    .hero .row {
        text-align: center;
    }
    
    .hero img {
        max-width: 150px;
        height: 150px;
        margin-bottom: 1.5rem;
    }
    
    /* Ensure proper spacing between image and text on mobile */
    .hero .col-md-3 {
        margin-bottom: 1.5rem;
    }
    
    .hero .col-md-9 {
        text-align: center;
    }
    
    /* Theme toggle on mobile */
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    /* Better navbar toggler styling on mobile */
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        min-width: 36px;
        height: 36px;
    }
    
    .navbar-toggler-icon i {
        font-size: 1.1rem;
    }
    
    /* Ensure buttons don't overlap */
    .navbar .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
    
    .theme-toggle.d-lg-none {
        min-width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    /* Ensure navbar items are properly spaced on mobile */
    .navbar-nav {
        margin-top: 0.5rem;
    }
    
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
}

@media (max-width: 576px) {
    .hero {
        padding: 1.5rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .gap-2 {
        gap: 0.5rem !important;
    }
    
    /* Make buttons stack on very small screens */
    .d-flex.flex-wrap.gap-2 {
        flex-direction: column;
    }
    
    .d-flex.flex-wrap.gap-2 .btn {
        width: 100%;
    }
    
    /* Smaller theme toggle on very small screens */
    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        padding: 0.25rem;
    }
    
    /* Adjust section spacing on mobile */
    section {
        margin-bottom: 2rem !important;
        padding-top: 2rem !important;
    }
    
    /* Better spacing for service cards on mobile */
    .row.g-4 {
        --bs-gutter-y: 1rem;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive tables */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Card and component dark mode support */
.card {
    transition: var(--transition);
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
    border-width: 1px;
}

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

[data-theme="dark"] .card {
    border-color: var(--border);
    border-width: 1px;
}

.card-header {
    background: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .card-header {
    border-color: var(--border) !important;
}

.card-body {
    background: var(--bg);
    color: var(--text);
}

.list-group-item {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
    border-width: 1px;
}

.list-group-item .text-muted {
    color: var(--text-light) !important;
    font-weight: 500;
}

/* Ensure icons in list items are visible */
.list-group-item .text-muted i,
.list-group-item .text-muted .bi,
.list-group-item .text-muted [class^="bi-"],
.list-group-item .text-muted [class*=" bi-"] {
    color: var(--text-light) !important;
}

/* Ensure icons with text utility classes are visible */
.bi.text-warning,
.bi.text-muted,
.bi.text-success,
.bi.text-primary,
.bi.text-secondary {
    display: inline-block !important;
    font-style: normal !important;
}

/* Ensure icons in card-body are visible */
.card-body .bi,
.card-body [class^="bi-"],
.card-body [class*=" bi-"] {
    display: inline-block !important;
}

[data-theme="dark"] .list-group-item {
    border-color: var(--border);
    background-color: var(--bg);
    color: var(--text);
}

[data-theme="dark"] .list-group-item .text-muted {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .list-group-item .text-muted i,
[data-theme="dark"] .list-group-item .text-muted .bi,
[data-theme="dark"] .list-group-item .text-muted [class^="bi-"],
[data-theme="dark"] .list-group-item .text-muted [class*=" bi-"] {
    color: #cbd5e1 !important;
}

.text-muted {
    color: var(--text-light) !important;
    font-weight: 500;
}

[data-theme="dark"] .text-muted {
    color: #cbd5e1 !important;
    font-weight: 500;
}

.text-secondary {
    color: var(--text) !important;
    opacity: 0.9;
}

[data-theme="dark"] .text-secondary {
    color: #e2e8f0 !important;
    opacity: 1;
}

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

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

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

/* Smooth transitions for theme changes */
body, .card, .navbar, .btn, .nav-link, .theme-toggle, footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Smooth Scrolling Offset */
html {
    scroll-padding-top: 80px;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 70px;
    }
}

/* Specific color overrides for BI icons */
.bi.text-warning {
    color: #ffc107 !important;
}

[data-theme="dark"] .bi.text-warning {
    color: #ffc107 !important;
}

.bi.text-muted {
    color: var(--text-light) !important;
}

[data-theme="dark"] .bi.text-muted {
    color: #cbd5e1 !important;
}
