/**
 * SMP Student Portal Enhancer - Frontend Styles
 * 
 * @package     SMP Student Portal Enhancer
 * @version     3.0.0 - Dashboard Header & Menu Styling
 * @filepath    /wp-content/plugins/smp-portal-enhancer/assets/frontend.css
 */

/* ============================================================================
   STUDENT DASHBOARD HEADER & MENU STYLING - v3.0.0
   
   CRITICAL: Override SMP default styles with our blue gradient theme
   These styles use !important to ensure they apply regardless of WordPress theme
   ============================================================================ */

/* Dashboard Header Container */
.wlsm-header,
.wlsm-dashboard-header,
.wlsm-st-dashboard-header,
.elementor-widget-container .wlsm-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%) !important;
    color: #fff !important;
    padding: 25px 30px !important;
    border-bottom: 4px solid #004d6d !important;
    margin-bottom: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2) !important;
}

/* Dashboard Header Title (e.g., "Student Dashboard") */
.wlsm-header h2,
.wlsm-header h3,
.wlsm-dashboard-header h2,
.wlsm-dashboard-header h3,
.wlsm-st-dashboard-header h2,
.wlsm-st-dashboard-header h3,
.wlsm-header .wlsm-section-title,
.wlsm-dashboard-header .wlsm-section-title {
    color: #fff !important;
    font-weight: 700 !important;
    margin: 0 !important;
    font-size: 24px !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Dashboard Header Icon */
.wlsm-header .dashicons,
.wlsm-header i,
.wlsm-dashboard-header .dashicons,
.wlsm-dashboard-header i {
    color: #fff !important;
    opacity: 0.95 !important;
}

/* Navigation Menu Container */
.wlsm-navigation,
.wlsm-st-navigation,
.wlsm-navigation-list,
.wlsm-st-navigation ul {
    background: #f8f9fa !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

/* Navigation Menu Items */
.wlsm-navigation-link,
.wlsm-st-navigation a,
.wlsm-navigation li a,
nav.wlsm-navigation a {
    color: #333 !important;
    background: #fff !important;
    border-left: 4px solid transparent !important;
    padding: 15px 20px !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.3s ease !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

/* Navigation Menu Item Hover */
.wlsm-navigation-link:hover,
.wlsm-st-navigation a:hover,
.wlsm-navigation li a:hover {
    background: linear-gradient(90deg, #e7f5fe 0%, #f0f8ff 100%) !important;
    border-left-color: #0073aa !important;
    color: #0073aa !important;
    padding-left: 25px !important;
}

/* Active Menu Item */
.wlsm-navigation-link.wlsm-active,
.wlsm-st-navigation a.wlsm-active,
.wlsm-navigation li.wlsm-active a,
.wlsm-navigation-link[aria-current="page"] {
    background: linear-gradient(90deg, #0073aa 0%, #005a87 100%) !important;
    border-left-color: #004d6d !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Active Menu Item Icon */
.wlsm-navigation-link.wlsm-active .dashicons,
.wlsm-navigation-link.wlsm-active i,
.wlsm-st-navigation a.wlsm-active .dashicons,
.wlsm-st-navigation a.wlsm-active i {
    color: #fff !important;
}

/* Menu Item Icons */
.wlsm-navigation-link .dashicons,
.wlsm-navigation-link i,
.wlsm-st-navigation a .dashicons,
.wlsm-st-navigation a i {
    color: #0073aa !important;
    margin-right: 10px !important;
    font-size: 18px !important;
}

/* Menu Item Icons on Hover */
.wlsm-navigation-link:hover .dashicons,
.wlsm-navigation-link:hover i,
.wlsm-st-navigation a:hover .dashicons,
.wlsm-st-navigation a:hover i {
    color: #0073aa !important;
}

/* Menu Dividers */
.wlsm-navigation li,
.wlsm-st-navigation li {
    border-bottom: 1px solid #e0e0e0 !important;
    margin: 0 !important;
    list-style: none !important;
}

.wlsm-navigation li:last-child,
.wlsm-st-navigation li:last-child {
    border-bottom: none !important;
}

/* Student Info in Header (if present) */
.wlsm-header .wlsm-student-info,
.wlsm-dashboard-header .wlsm-student-info {
    color: #fff !important;
    opacity: 0.95 !important;
    font-size: 14px !important;
    margin-top: 10px !important;
}

/* Logout Button in Header */
.wlsm-header .wlsm-logout-btn,
.wlsm-header .button,
.wlsm-dashboard-header .wlsm-logout-btn,
.wlsm-dashboard-header .button {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    padding: 8px 20px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.wlsm-header .wlsm-logout-btn:hover,
.wlsm-header .button:hover,
.wlsm-dashboard-header .wlsm-logout-btn:hover,
.wlsm-dashboard-header .button:hover {
    background: #fff !important;
    color: #0073aa !important;
}

/* Breadcrumbs in Header */
.wlsm-header .wlsm-breadcrumb,
.wlsm-dashboard-header .wlsm-breadcrumb {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 13px !important;
    margin-top: 5px !important;
}

.wlsm-header .wlsm-breadcrumb a,
.wlsm-dashboard-header .wlsm-breadcrumb a {
    color: #fff !important;
    text-decoration: underline !important;
}

/* Mobile Menu Toggle Button */
.wlsm-navigation-toggle,
.wlsm-menu-toggle {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 4px !important;
}

.wlsm-navigation-toggle:hover,
.wlsm-menu-toggle:hover {
    background: linear-gradient(135deg, #005a87 0%, #004d6d 100%) !important;
}

/* Dashboard Page Title (below header) */
.wlsm-content-area .wlsm-section-title,
.wlsm-content-area h1,
.wlsm-content-area h2.wlsm-title {
    color: #0073aa !important;
    border-bottom: 3px solid #0073aa !important;
    padding-bottom: 10px !important;
    margin-bottom: 20px !important;
    font-weight: 700 !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .wlsm-header,
    .wlsm-dashboard-header,
    .wlsm-st-dashboard-header {
        padding: 20px 15px !important;
    }
    
    .wlsm-header h2,
    .wlsm-header h3,
    .wlsm-dashboard-header h2,
    .wlsm-dashboard-header h3 {
        font-size: 20px !important;
    }
    
    .wlsm-navigation-link,
    .wlsm-st-navigation a {
        padding: 12px 15px !important;
    }
    
    .wlsm-navigation-link:hover,
    .wlsm-st-navigation a:hover {
        padding-left: 20px !important;
    }
}

/* ============================================================================
   DASHBOARD LAYOUT FIX - ABSOLUTE FINAL SOLUTION
   
   Root Cause Found: wlsm-grid has margin-bottom: 32px even with height: 0px
   
   Solution: Aggressively remove ALL margins from wlsm-grid and grid children
   ============================================================================ */

/* Main dashboard container - Convert to CSS Grid */
.wlsm-content-area.wlsm-section-dashboard.wlsm-student-dashboard {
    display: grid !important;
    grid-template-columns: 2fr 1fr; /* Left: 66.67%, Right: 33.33% */
    grid-template-rows: auto auto auto; /* 3 rows for left column content */
    gap: 20px;
    align-items: start; /* All items align to top */
}

/* CRITICAL: Kill wlsm-grid margins completely */
.wlsm-grid {
    display: contents !important; /* Make children participate in parent grid */
    margin: 0 !important; /* â† THE FIX: Remove the 32px bottom margin */
    padding: 0 !important;
}

/* Profile Card (Student Details) - Column 1, Row 1 */
.wlsm-card.wlsm-profile-card {
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin: 0 !important;
}

/* Stats Section (Contains Outstanding Bill) - Column 2, Spans All Rows */
.wlsm-stats-section {
    grid-column: 2 !important;
    grid-row: 1 / -1 !important; /* Span from row 1 to last row */
    align-self: start !important;
    margin: 0 !important;
}

/* Notices Heading - Column 1, Row 2 */
.wlsm-section-heading {
    grid-column: 1 !important;
    grid-row: 2 !important;
    margin: 0 !important; /* Remove SMP's default 2rem 0 1.5rem */
    margin-bottom: 10px !important; /* Small gap to notices content */
    padding: 0 !important;
}

/* Notices Content Container - Column 1, Row 3 */
.wlsm-section-heading + div {
    grid-column: 1 !important;
    grid-row: 3 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Target the actual notices section wrapper */
.wlsm-st-recent-notices-section {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================================================
   INTEGRATION WITH SMP'S EXISTING CARD STRUCTURE
   ============================================================================ */

.spe-outstanding-card.wlsm-card {
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 8px;
    padding: 0;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.spe-outstanding-card .wlsm-stats-header {
    margin: 0;
    padding: 15px 20px;
    color: #0073aa;
    font-size: 1.2em;
    border-bottom: 2px solid #0073aa;
    background: linear-gradient(135deg, #e7f5fe 0%, #cce7f5 100%);
}

.spe-outstanding-card .wlsm-stats-header h4 {
    margin: 0 0 10px 0;
    color: #0073aa;
}

/* v1.3.5 UPDATED: Current Term Badge - No period text */
.spe-current-term-badge {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
    box-shadow: 0 2px 4px rgba(0,115,170,0.3);
}

.spe-current-term-badge .spe-term-icon {
    font-size: 16px;
    margin-right: 5px;
}

.spe-current-term-badge strong {
    color: #fff;
}

.spe-outstanding-card .wlsm-stats-content {
    padding: 20px;
}

/* ============================================================================
   OUTSTANDING BILL GRID LAYOUT
   ============================================================================ */

.spe-outstanding-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.spe-outstanding-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
    transition: all 0.3s ease;
}

.spe-outstanding-item:hover {
    background: #e7f5fe;
    box-shadow: 0 2px 4px rgba(0,115,170,0.1);
}

.spe-outstanding-item.spe-arrears {
    background: #fff8e5;
    border-left-color: #ffc107;
}

.spe-outstanding-item.spe-total {
    background: #e7f5fe;
    border-left-color: #0073aa;
    border-left-width: 6px;
    padding: 20px 25px;
}

.spe-outstanding-item .spe-label {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.spe-outstanding-item .spe-amount {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

.spe-outstanding-item.spe-total .spe-label strong {
    font-size: 18px;
}

.spe-outstanding-item.spe-total .spe-amount strong {
    font-size: 28px;
    color: #0073aa;
}

/* ============================================================================
   TERM TOGGLE SECTION
   ============================================================================ */

.spe-term-toggle {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.spe-toggle-label {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.spe-term-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

/* Invoice Link Section */
.spe-invoice-link {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.spe-invoice-link .button-primary {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
}

/* ============================================================================
   LEGACY STYLES (Keeping for backward compatibility)
   ============================================================================ */

.spe-outstanding-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.spe-outstanding-label {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.spe-outstanding-amount {
    font-size: 28px;
    font-weight: bold;
    color: #d32f2f;
}

.spe-outstanding-amount.paid {
    color: #00a32a;
}

.spe-payment-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.spe-payment-btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,115,170,0.3);
}

.spe-payment-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    box-shadow: 0 6px 8px rgba(0,115,170,0.4);
    transform: translateY(-2px);
    color: white;
}

.spe-payment-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,115,170,0.3);
}

.spe-payment-note {
    margin-top: 15px;
    padding: 12px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}

/* Term selector */
.spe-term-selector {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.spe-term-btn {
    flex: 1;
    padding: 12px 16px;
    background: white;
    border: 2px solid #0073aa;
    border-radius: 6px;
    color: #0073aa;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.spe-term-btn:hover {
    background: #e7f5fe;
    box-shadow: 0 3px 6px rgba(0,115,170,0.2);
    transform: translateY(-1px);
}

.spe-term-btn.spe-term-active {
    background: #0073aa;
    color: white;
    box-shadow: 0 4px 8px rgba(0,115,170,0.3);
}

.spe-term-details {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #0073aa;
}

.spe-term-details.spe-show {
    display: block;
}

.spe-fees-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.spe-fees-table th,
.spe-fees-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.spe-fees-table th {
    background: #0073aa;
    color: white;
    font-weight: 600;
}

.spe-fees-table tr:hover {
    background: #f8f9fa;
}

.spe-loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
}

.spe-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #d63638;
    border-radius: 4px;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    /* Stack columns on mobile - single column layout */
    .wlsm-content-area.wlsm-section-dashboard.wlsm-student-dashboard {
        grid-template-columns: 1fr !important; /* Single column */
        grid-template-rows: auto auto auto auto; /* 4 rows stacked */
    }
    
    /* Profile card: Full width, Row 1 */
    .wlsm-card.wlsm-profile-card {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    
    /* Stats section: Full width, Row 2 */
    .wlsm-stats-section {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }
    
    /* Notices heading: Full width, Row 3 */
    .wlsm-section-heading {
        grid-column: 1 !important;
        grid-row: 3 !important;
    }
    
    /* Notices content: Full width, Row 4 */
    .wlsm-section-heading + div {
        grid-column: 1 !important;
        grid-row: 4 !important;
    }
    
    .spe-outstanding-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .spe-outstanding-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .spe-outstanding-item .spe-amount {
        font-size: 20px;
    }
    
    .spe-outstanding-item.spe-total .spe-amount strong {
        font-size: 24px;
    }
    
    .spe-term-buttons {
        grid-template-columns: 1fr;
    }
    
    .spe-term-selector {
        flex-direction: column;
    }
    
    .spe-payment-btn {
        width: 100%;
        text-align: center;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .wlsm-content-area.wlsm-section-dashboard.wlsm-student-dashboard {
        grid-template-columns: 1.5fr 1fr; /* Slightly adjust ratio for tablets */
    }
}

/* ============================================================================
   PAYSTACK PAYMENT TABS (v2.6.0)
   ============================================================================ */

/* Payment tabs - inline styles in JS for immediate visibility */
.spe-payment-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.spe-tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
}

.spe-tab-btn:hover {
    background: #e8f4f8;
    color: #0073aa;
}

.spe-tab-btn.spe-tab-active {
    background: #fff;
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* Tab content areas */
.spe-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.spe-tab-content.spe-tab-active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Paystack tab specific styles */
.spe-paystack-info {
    background: #f0f8ff;
    border-left: 4px solid #0073aa;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.spe-paystack-info p {
    margin: 10px 0;
}

.spe-paystack-info ul {
    margin: 10px 0 10px 20px;
}

.spe-paystack-info ul li {
    margin: 5px 0;
    color: #333;
}

.spe-paystack-amount {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

/* Paystack payment button */
#spe-pay-with-paystack {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #00c853 0%, #00a843 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 200, 83, 0.3);
}

#spe-pay-with-paystack:hover {
    background: linear-gradient(135deg, #00a843 0%, #008833 100%);
    box-shadow: 0 6px 8px rgba(0, 200, 83, 0.4);
    transform: translateY(-2px);
}

#spe-pay-with-paystack:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Responsive design for payment tabs */
@media (max-width: 600px) {
    .spe-payment-tabs {
        flex-direction: column;
    }
    
    .spe-tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .spe-tab-btn.spe-tab-active {
        border-left-color: #0073aa;
        border-bottom-color: transparent;
    }
}