/* =============================================================
   University of Ibadan Agricultural Engineering Department Styles
   ============================================================= */

:root {
    /* UI Brand Colors */
    --ui-green: #2d5a27;
    --ui-light-green: #4a7c59;
    --ui-gold: #ffa500;
    --ui-light-gold: #ffb84d;
    --ui-dark-green: #064014;

    /* Extended Palette */
    --primary-color: #2d5a27;
    --secondary-color: #4a7c59;
    --accent-color: #ffa500;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;

    /* Typography */
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Inter', sans-serif;

    /* Spacing */
    --section-padding: 5rem 0;
    --card-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);

    /* From portal section */
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--dark-color);
    scroll-behavior: smooth;
    padding-top: 80px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    font-weight: 600;
    line-height: 1.2;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    position: relative;
}

.title-underline {
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    margin: 0 auto 2rem;
    border-radius: 2px;
}

/* ================= Navigation ================= */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 80px;
}

.navbar-brand {
    font-weight: 700;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    margin: 0 0.25rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateY(-2px);
}

/* ================= Hero Section — FIXED ================= */
/* FIX 1: position:relative + flex removed from section, overlay now absolute */
.hero-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* FIX 2: overlay is now absolute inset:0 so it covers the full background image */
.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Content sits above overlay */
.hero-overlay .container {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill-opacity='0.1' fill='%23ffffff'%3E%3Cpath d='M10,20 Q20,10 30,20 T50,20 T70,20 T90,20'/%3E%3Cpath d='M10,40 Q20,30 30,40 T50,40 T70,40 T90,40'/%3E%3Cpath d='M10,60 Q20,50 30,60 T50,60 T70,60 T90,60'/%3E%3Cpath d='M10,80 Q20,70 30,80 T50,80 T70,80 T90,80'/%3E%3C/g%3E%3C/svg%3E") repeat;
    animation: float 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

.hero-section h1 {
    animation: fadeInUp 1s ease-out;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.hero-section .lead {
    animation: fadeInUp 1.2s ease-out;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
}

/* FIX 3: badges use flexbox wrap instead of inline-block with margin */
.hero-badges {
    animation: fadeInUp 1.4s ease-out;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    padding: 0 1rem;
}

.hero-badges .badge {
    padding: 0.75rem 1.25rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.hero-badges .badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

/* ================= Cards ================= */
.card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    background: white;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

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

.card:hover::before {
    transform: scaleX(1);
}

.card-header {
    border-bottom: none;
    font-weight: 600;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(45, 90, 39, 0.05), rgba(255, 165, 0, 0.05));
}

.card-body {
    padding: 2rem;
}

.card-title {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.card-title i {
    color: var(--accent-color);
}

/* ================= Buttons ================= */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 100%;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    border: none;
}

.btn-secondary {
    background: var(--text-light);
    color: white;
    border: none;
}

.btn-secondary:hover { background: var(--text-dark); }

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-danger:hover { background: #c82333; }

.btn-warning {
    background: var(--warning);
    color: var(--text-dark);
    border: none;
}

.btn-warning:hover { background: #e0a800; }

.btn-outline-light {
    border: 2px solid white;
    color: white;
    background: transparent;
}

.btn-outline-light:hover {
    background-color: white;
    border-color: white;
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ================= Utilities ================= */
.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
}
.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%) !important;
}
.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #6f42c1 100%) !important;
}
.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--accent-color) 100%) !important;
}
.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e83e8c 100%) !important;
}

/* ================= Sections ================= */
section {
    padding: 5rem 0;
}

.section-title {
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    border-radius: 2px;
}

/* ================= Feature Icons ================= */
.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(45, 90, 39, 0.3);
}

.feature-icon:hover {
    transform: rotate(360deg) scale(1.1);
}

/* ================= Scroll Animations ================= */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

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

/* ================= Header (portal pages) ================= */
.header {
    background: linear-gradient(135deg, var(--ui-green), var(--ui-dark-green));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 60px;
    height: 60px;
    background: var(--ui-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--ui-dark-green);
    font-size: 1.2rem;
}

.header-text h1 { font-size: 1.5rem; margin-bottom: 0.2rem; }
.header-text p  { font-size: 0.9rem; opacity: 0.9; }

.user-info { text-align: right; }
.user-info span { display: block; font-size: 0.9rem; }

.logout-btn {
    background: var(--ui-gold);
    color: var(--ui-dark-green);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 0.5rem;
    display: inline-block;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #e6c200;
    transform: translateY(-2px);
}

/* ================= Nav Tabs ================= */
.nav-tabs {
    background: white;
    border-bottom: 3px solid var(--ui-green);
    padding: 0;
    margin: 0;
    display: flex;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.nav-tab {
    background: none;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-weight: 500;
}

.nav-tab.active,
.nav-tab:hover {
    background: #E8F5E8;
    color: var(--ui-dark-green);
    border-bottom-color: var(--ui-green);
}

/* ================= Stats Grid ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--ui-green), var(--ui-dark-green));
    color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--ui-gold);
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ================= Forms ================= */
.form-group { margin-bottom: 1.5rem; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--ui-green);
    box-shadow: 0 0 0 3px rgba(11, 93, 30, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ================= Tables ================= */
.table-container { overflow-x: auto; margin-top: 1rem; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.table tr:hover { background: #e8f5e8; }
.table tr:last-child td { border-bottom: none; }

/* ================= Alerts ================= */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
    position: relative;
}

.alert-success { background: #d4edda; border-color: var(--success-color); color: #155724; }
.alert-danger  { background: #f8d7da; border-color: var(--danger-color);  color: #721c24; }
.alert-warning { background: #fff3cd; border-color: var(--warning-color); color: #856404; }
.alert-info    { background: #cce7f0; border-color: var(--info-color);    color: #0c5460; }

/* ================= Login ================= */
.login-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    background: #f8f9fa;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E8F5E8, #f8f9fa);
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.login-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* ================= Loading ================= */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Utility Classes ================= */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-success { color: var(--success-color); }
.text-danger  { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info    { color: var(--info-color); }
.text-muted   { color: var(--text-light); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-none  { display: none; }
.d-block { display: block; }
.d-flex  { display: flex; }
.justify-center { justify-content: center; }
.align-center   { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }
.rounded { border-radius: 8px; }

/* ================= Responsive ================= */
@media (max-width: 992px) {
    section { padding: 4rem 0; }
    .navbar-nav { text-align: center; padding: 1rem 0; }
    .navbar-nav .nav-link { padding: 0.75rem 1rem !important; }
}

@media (max-width: 768px) {
    section { padding: 3rem 0; }
    .section-title { font-size: 2rem; }

    .hero-section { min-height: 100vh; padding: 0; }
    .hero-section h1   { font-size: 2rem !important; }
    .hero-section .lead { font-size: 1rem; padding: 0 0.5rem; }

    .hero-badges { gap: 0.5rem; padding: 0 0.75rem; }
    .hero-badges .badge { font-size: 0.8rem; padding: 0.55rem 0.9rem; }

    .card-body { padding: 1.5rem; }
    .btn-lg { padding: 0.875rem 1.75rem; }
    .login-card { padding: 2rem; margin: 1rem; }

    .header-content { flex-direction: column; text-align: center; gap: 1rem; }
    .header-text h1 { font-size: 1.2rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .nav-tabs { flex-wrap: wrap; }
    .nav-tab  { flex: 1; min-width: 120px; }
    .table th, .table td { padding: 0.5rem; font-size: 0.9rem; }
}

@media (max-width: 576px) {
    body { padding-top: 70px; }
    section { padding: 2.5rem 0; }

    .hero-section { min-height: 100svh; }
    .hero-section h1    { font-size: 1.6rem !important; }
    .hero-section .lead { font-size: 0.95rem; }

    /* Stack badges into single column */
    .hero-badges {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: 0 2rem;
    }
    .hero-badges .badge {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        font-size: 0.82rem;
        padding: 0.6rem 1rem;
        white-space: normal;
        text-align: center;
    }

    .btn    { padding: 0.65rem 1.25rem; font-size: 0.85rem; }
    .btn-lg { padding: 0.75rem 1.5rem;  font-size: 0.9rem; }
    .card-body { padding: 1.25rem; }
    .section-title { font-size: 1.75rem; }
    .navbar-brand img { height: 35px !important; }
    .brand-title    { font-size: 0.9rem; }
    .brand-subtitle { font-size: 0.7rem; }
}

@media (max-width: 414px) {
    .section-title { font-size: 1.5rem; }
    .hero-section h1    { font-size: 1.4rem !important; }
    .hero-section .lead { font-size: 0.92rem; }
    .hero-badges .badge { font-size: 0.78rem; padding: 0.55rem 0.9rem; }
    .card-body { padding: 1rem; }
}

@media (max-width: 375px) {
    body    { padding-top: 70px; }
    .navbar { min-height: 70px; }
    .section-title { font-size: 1.4rem; }
    .hero-section h1    { font-size: 1.3rem !important; }
    .hero-section .lead { font-size: 0.9rem; }
    .hero-badges .badge { font-size: 0.75rem; padding: 0.5rem 0.85rem; max-width: 260px; }
    .btn { font-size: 0.8rem; padding: 0.6rem 1rem; }
    .header-text h1 { font-size: 1rem; }
    .header-text p  { font-size: 0.8rem; }
}

@media (max-width: 320px) {
    .section-title { font-size: 1.25rem; }
    .hero-section h1    { font-size: 1.15rem !important; }
    .hero-section .lead { font-size: 0.85rem; }
    .hero-badges .badge { font-size: 0.72rem; padding: 0.45rem 0.75rem; max-width: 240px; }
    .card-title  { font-size: 1.2rem; }
    .stat-number { font-size: 2rem; }
    .btn { font-size: 0.75rem; padding: 0.5rem 0.9rem; }
}
