/* ============================================================
   IET-GH Frontend — Professional Theme Enhancements
   ============================================================ */

html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(228, 30, 47, 0.18);
    color: var(--iet-dark);
}

:focus-visible {
    outline: 2px solid var(--iet-primary);
    outline-offset: 3px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 12px 20px;
    background: var(--iet-primary);
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    color: var(--white);
}

/* Sticky header scroll state */
.site-header {
    transition: box-shadow var(--iet-transition), padding var(--iet-transition), background var(--iet-transition);
}

.site-header.scrolled {
    box-shadow: 0 8px 32px rgba(37, 38, 56, 0.12);
}

.site-header.scrolled .navbar {
    padding-top: 8px;
    padding-bottom: 8px;
}

.site-header.scrolled .navbar-brand .logo {
    max-height: 50px;
    transition: max-height var(--iet-transition);
}

/* Top bar refinement */
.top-bar-list a {
    text-decoration: none;
    opacity: 0.92;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.top-bar-list a:hover {
    opacity: 1;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

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

/* Navigation */
.navbar-nav .nav-link {
    position: relative;
    border-radius: 8px;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.25rem;
    height: 2px;
    background: var(--iet-primary);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    transform: scaleX(1);
}

.dropdown-item {
    border-radius: 6px;
    margin: 0 8px;
    width: calc(100% - 16px);
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(228, 30, 47, 0.06);
    padding-left: 1.4rem;
}

.navbar-toggler {
    border: 1px solid var(--iet-border);
    padding: 8px 12px;
    border-radius: 10px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(228, 30, 47, 0.15);
}

.mobile-nav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 0 8px;
    margin-top: 12px;
    border-top: 1px solid var(--iet-border);
}

.mobile-nav-actions .btn {
    flex: 1 1 auto;
    min-width: 140px;
    text-align: center;
}

.shop-cart-btn {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--iet-border);
    transition: all 0.25s ease;
}

.shop-cart-btn:hover {
    border-color: var(--iet-primary);
    color: var(--iet-primary);
    background: rgba(228, 30, 47, 0.06);
}

.shop-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--iet-primary);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Buttons — unified polish */
.btn-green,
.btn-gold,
.btn-outline-green {
    border-radius: var(--iet-radius);
    letter-spacing: 0.4px;
}

.btn-outline-green {
    border-radius: var(--iet-radius);
}

/* Page header */
.page-header {
    padding: 80px 0 72px;
}

.page-header-eyebrow {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--iet-primary);
    margin-bottom: 12px;
    opacity: 0.95;
}

.page-header .breadcrumb {
    background: rgba(255, 255, 255, 0.06);
    padding: 10px 18px;
    border-radius: 50px;
    display: inline-flex;
    margin-top: 8px;
}

/* Content typography */
.page-main-panel,
.wysiwyg-content,
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.page-main-panel h2,
.wysiwyg-content h2,
.post-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.page-main-panel h3,
.wysiwyg-content h3,
.post-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.page-main-panel ul,
.page-main-panel ol,
.wysiwyg-content ul,
.wysiwyg-content ol {
    padding-left: 1.4rem;
    margin-bottom: 1.25rem;
}

.page-main-panel blockquote,
.wysiwyg-content blockquote {
    border-left: 4px solid var(--iet-primary);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--bg-section);
    border-radius: 0 var(--iet-radius-sm) var(--iet-radius-sm) 0;
    font-style: italic;
    color: var(--iet-heading);
}

/* Global form polish */
.form-control,
.form-select {
    border-radius: var(--iet-radius-sm);
    border-color: var(--iet-border);
    padding: 0.65rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--iet-primary);
    box-shadow: 0 0 0 0.2rem rgba(228, 30, 47, 0.12);
}

.form-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--iet-heading);
    margin-bottom: 0.4rem;
}

/* Cards — shared elevation */
.news-card,
.doc-card,
.profile-card,
.division-card,
.service-card,
.news-featured,
.sidebar-block {
    border-radius: var(--iet-radius-lg);
}

/* Scroll reveal */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-on-scroll.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-on-scroll.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-on-scroll.reveal-delay-3 { transition-delay: 0.3s; }

/* Back to top */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1030;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: var(--iet-dark);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.25s ease;
    box-shadow: 0 8px 24px rgba(37, 38, 56, 0.25);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--iet-primary);
}

/* Toast notifications */
.site-toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 32px));
}

.site-toast {
    padding: 14px 20px;
    background: var(--iet-dark);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.35s ease both;
    pointer-events: auto;
}

.site-toast--success {
    background: #198754;
}

.site-toast--error {
    background: var(--iet-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer enhancements */
.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

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

.newsletter-form .input-group {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.newsletter-form .form-control {
    border: none;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.95);
}

.newsletter-form .btn-gold {
    padding: 14px 22px;
    border-radius: 0;
    white-space: nowrap;
}

.newsletter-feedback {
    display: block;
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 1.25rem;
}

.newsletter-feedback.is-success {
    color: #7dcea0;
}

.newsletter-feedback.is-error {
    color: #ff8a8a;
}

.footer-top h5 {
    position: relative;
    padding-bottom: 12px;
}

.footer-top h5::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 32px;
    height: 2px;
    background: var(--iet-primary);
    border-radius: 2px;
}

.footer-links a {
    display: inline-block;
    padding: 2px 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-links a:hover {
    transform: translateX(4px);
}

/* Tables on public pages */
.standard-page .table {
    border-radius: var(--iet-radius);
    overflow: hidden;
    border: 1px solid var(--iet-border);
}

.standard-page .table thead th {
    background: var(--bg-section);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--iet-heading);
    border-bottom-width: 1px;
    white-space: nowrap;
}

/* Pagination polish */
.pagination {
    gap: 4px;
}

.pagination .page-link {
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    border-color: var(--iet-border);
}

/* Accordion polish */
.accordion-item {
    border-radius: var(--iet-radius-sm) !important;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--iet-border) !important;
}

.accordion-button {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Stats & CTA sections */
.stats-section {
    position: relative;
    overflow: hidden;
}

.stats-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.stats-section .container {
    position: relative;
    z-index: 1;
}

.stat-item {
    padding: 12px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 991px) {
    .navbar-collapse {
        padding: 16px 0 8px;
        margin-top: 12px;
        border-top: 1px solid var(--iet-border);
    }

    .navbar-nav .nav-link::after {
        display: none;
    }

    .page-header {
        padding: 56px 0 48px;
    }

    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

@media (min-width: 992px) {
    .mobile-nav-actions {
        display: none;
    }
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.captcha-widget {
    max-width: 100%;
}

.captcha-widget .form-control {
    max-width: 220px;
}
