/* GSStudentIS Application Styles */

html, body {
    font-family: 'Roboto', sans-serif;
}

/* Fix for Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI4Ni42OTQgNzIuMzU0QzI4Ny40ODQgNzMuMTQ2NCAyODcuOTY5IDc0LjI0MDcgMjg3Ljk2OSA3NS40NTg1TDI4Ny45NjkgOTBDMjg3Ljk2OSA5Mi43NjE0IDI4NS43MyA5NSAyODIuOTY5IDk1TDI0NC4wMzEgOTVDMjQxLjI3IDk1IDIzOSA5Mi43NjE0IDIzOSA5MEwyMzkgNzUuNDU4NUMyMzkgNzQuMjU0MyAyMzkuNDcgNzMuMTc4IDI0MC4yNDMgNzIuMzg3NEwyNjAuMjg5IDUyLjI5ODNDMjYxLjA3MyA1MS41MTk4IDI2Mi4xNDggNTEgMjYzLjUwNiA1MVoiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGQ9Ik0yNjMuMjg2IDY2LjcwNTFMMjYzLjI4NiA3Ny4wOTczTDI2My4yODYgNzAuMTcwNEMyNjMuMjg2IDY4Ljg5OTkgMjY0LjMxNiA2Ny44NjkyIDI2NS41ODYgNjcuODY5MkwyNjUuNTg2IDY2LjcwNTFMMjYzLjI4NiA2Ni43MDUxWiIgZmlsbD0iIzFEMUQxQiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PHBhdGggZD0iTTI2NC45MjkgNjYuNzA1MUwyNjIuNjI5IDY2LjcwNTFMMjYyLjYyOSA3Ny4wOTczTDI2NC45MjkgNzcuMDk3M0wyNjQuOTI5IDY2LjcwNTFaIiBmaWxsPSIjRkZGRkZGIi8+PHBhdGggZD0iTTI2NS41ODYgODAuODI2NUMyNjcuMjQ3IDgwLjgyNjUgMjY4LjU4NiA4Mi4xNjQ5IDI2OC41ODYgODMuODI2NUMyNjguNTg2IDg1LjQ4ODEgMjY3LjI0NyA4Ni44MjY1IDI2NS41ODYgODYuODI2NUMyNjMuOTI1IDg2LjgyNjUgMjYyLjU4NiA4NS40ODgxIDI2Mi41ODYgODMuODI2NUMyNjIuNTg2IDgyLjE2NDkgMjYzLjkyNSA4MC44MjY1IDI2NS41ODYgODAuODI2NVoiIGZpbGw9IiNGRkZGRkYiLz48L2c+PC9zdmc+) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Custom utility classes */
.cursor-pointer {
    cursor: pointer;
}

/* Pulse animation for highlighted elements */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--mud-palette-primary-rgb), 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(var(--mud-palette-primary-rgb), 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--mud-palette-primary-rgb), 0);
    }
}

/* ========================================
   SUCCESS/ACTION FEEDBACK ANIMATIONS
   ======================================== */

/* Success highlight animation - green flash */
@keyframes success-highlight {
    0% {
        background-color: transparent;
    }
    25% {
        background-color: rgba(76, 175, 80, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

.success-highlight {
    animation: success-highlight 1.5s ease-out;
}

/* Warning highlight animation - orange flash */
@keyframes warning-highlight {
    0% {
        background-color: transparent;
    }
    25% {
        background-color: rgba(255, 152, 0, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

.warning-highlight {
    animation: warning-highlight 1.5s ease-out;
}

/* Error highlight animation - red flash */
@keyframes error-highlight {
    0% {
        background-color: transparent;
    }
    25% {
        background-color: rgba(244, 67, 54, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

.error-highlight {
    animation: error-highlight 1.5s ease-out;
}

/* Fade out animation for removed items */
@keyframes fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

.fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

/* Processing state - subtle pulse on container */
@keyframes processing-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.processing {
    animation: processing-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Button loading spinner positioning */
.btn-loading-spinner {
    margin-right: 8px;
    margin-left: -4px;
}

.hover-elevation-4:hover {
    box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2),
                0px 4px 5px 0px rgba(0, 0, 0, 0.14),
                0px 1px 10px 0px rgba(0, 0, 0, 0.12) !important;
}

/* Status colors */
.status-draft { color: #9e9e9e; }
.status-submitted { color: #2196f3; }
.status-payment-pending { color: #ff9800; }
.status-payment-verified { color: #4caf50; }
.status-documents-verified { color: #8bc34a; }
.status-under-review { color: #9c27b0; }
.status-hod-accepted { color: #00bcd4; }
.status-hod-rejected { color: #f44336; }
.status-approved { color: #4caf50; }
.status-rejected { color: #f44336; }
.status-acceptance-confirmed { color: #009688; }
.status-enrolled { color: #3f51b5; }

/* Print styles */
.statement-print-document {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    .no-print {
        display: none !important;
    }

    .mud-appbar,
    .mud-drawer,
    .mud-snackbar,
    .mud-popover-provider,
    .mud-dialog-container,
    .mud-overlay,
    .statement-screen-content {
        display: none !important;
    }

    html,
    body {
        background: #ffffff !important;
        color: #111827 !important;
    }

    .mud-layout,
    .mud-main-content,
    .app-main,
    .app-content,
    .mud-container {
        background: #ffffff !important;
        margin: 0 !important;
        max-width: none !important;
        min-height: auto !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .statement-print-document {
        display: block !important;
        color: #111827;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 9.5pt;
        line-height: 1.35;
        width: 100%;
    }

    .statement-print-header {
        align-items: flex-start;
        border-bottom: 2px solid #111827;
        display: flex;
        justify-content: space-between;
        gap: 16px;
        padding-bottom: 10px;
        margin-bottom: 12px;
    }

    .statement-print-institution {
        font-size: 11pt;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .statement-print-header h1 {
        font-size: 18pt;
        line-height: 1.1;
        margin: 0;
    }

    .statement-print-header p,
    .statement-print-meta,
    .statement-print-footer,
    .statement-print-empty {
        color: #4b5563;
    }

    .statement-print-header p {
        margin: 4px 0 0;
    }

    .statement-print-meta {
        font-size: 8.5pt;
        text-align: right;
        white-space: nowrap;
    }

    .statement-print-section {
        break-inside: avoid;
        margin-top: 12px;
    }

    .statement-print-section h2 {
        border-bottom: 1px solid #d1d5db;
        font-size: 11pt;
        margin: 0 0 7px;
        padding-bottom: 4px;
    }

    .statement-print-details,
    .statement-print-summary {
        display: grid;
        gap: 8px;
    }

    .statement-print-details {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .statement-print-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-top: 10px;
    }

    .statement-print-summary--three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .statement-print-details div,
    .statement-print-summary div {
        border: 1px solid #d1d5db;
        border-radius: 4px;
        padding: 6px 8px;
    }

    .statement-print-details span,
    .statement-print-summary span {
        color: #6b7280;
        display: block;
        font-size: 7.5pt;
        text-transform: uppercase;
    }

    .statement-print-details strong,
    .statement-print-summary strong {
        color: #111827;
        display: block;
        font-size: 10pt;
        margin-top: 2px;
        overflow-wrap: anywhere;
    }

    .statement-print-table {
        border-collapse: collapse;
        font-size: 8.5pt;
        width: 100%;
    }

    .statement-print-table th,
    .statement-print-table td {
        border: 1px solid #d1d5db;
        padding: 5px 6px;
        vertical-align: top;
    }

    .statement-print-table th {
        background: #f3f4f6;
        font-weight: 700;
        text-align: left;
    }

    .statement-print-table tfoot td {
        background: #f9fafb;
        font-weight: 700;
    }

    .statement-print-table .amount {
        text-align: right;
        white-space: nowrap;
    }

    .statement-print-table .strong {
        font-weight: 700;
    }

    .statement-print-footer {
        border-top: 1px solid #d1d5db;
        font-size: 8pt;
        margin-top: 14px;
        padding-top: 6px;
    }
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile-first base styles */
.mobile-main-content {
    min-height: calc(100vh - 56px); /* Account for dense AppBar */
}

/* Responsive tables - horizontal scroll on mobile */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* MudBlazor grids use negative margins for spacing. On narrow app layouts that can
   make content appear clipped at the viewport edge, especially with a closed drawer. */
@media (max-width: 959px) {
    .mud-layout,
    .mud-main-content,
    .app-main {
        left: 0 !important;
    }

    .mud-main-content,
    .app-main {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    .app-content {
        width: 100% !important;
        max-width: 100vw !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        overflow-x: hidden;
    }

    .mud-appbar {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .app-content *,
    .application-flow * {
        min-width: 0;
        box-sizing: border-box;
    }

    .app-content .mud-grid,
    .application-flow .mud-grid {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .app-content .mud-grid-item,
    .application-flow .mud-grid-item {
        max-width: 100% !important;
    }

    .application-flow {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    .application-flow__panel {
        max-width: 100%;
    }

    .application-flow__side {
        position: static !important;
    }

    .app-content .mud-stack-row {
        max-width: 100%;
    }

    .app-content .mud-stack-row.flex-wrap {
        min-width: 0 !important;
    }

    .mud-alert,
    .mud-card,
    .mud-paper {
        max-width: 100%;
    }

    .mud-chip,
    .mud-button,
    .mud-typography {
        overflow-wrap: anywhere;
    }

    .mud-button-root {
        white-space: normal;
    }
}

/* Card-based table alternative for mobile */
@media (max-width: 599px) {
    .mud-stepper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mud-stepper .mud-stepper-content {
        overflow-x: hidden;
    }

    /* Make MudTable more readable on mobile */
    .mud-table-container {
        overflow-x: auto;
    }

    /* Reduce table cell padding on mobile */
    .mud-table .mud-table-cell {
        padding: 8px 12px !important;
    }

    /* Stack table headers on very small screens if needed */
    .mobile-stack-table .mud-table-row {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid var(--mud-palette-table-lines);
        padding: 12px 0;
    }

    .mobile-stack-table .mud-table-cell {
        display: flex;
        justify-content: space-between;
        padding: 4px 12px !important;
        border: none !important;
    }

    .mobile-stack-table .mud-table-cell::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 8px;
    }

    .mobile-stack-table thead {
        display: none;
    }

    /* Full-width buttons on mobile */
    .mobile-full-width {
        width: 100% !important;
    }

    /* Reduce dialog margins on mobile */
    .mud-dialog {
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
    }

    /* Improve form spacing on mobile */
    .mud-input-control {
        margin-bottom: 8px;
    }

    /* Make stat cards stack better */
    .mud-grid-item {
        padding: 8px !important;
    }

    /* Reduce heading sizes on mobile */
    .mud-typography-h4 {
        font-size: 1.5rem !important;
    }

    .mud-typography-h5 {
        font-size: 1.25rem !important;
    }

    .mud-typography-h6 {
        font-size: 1.1rem !important;
    }

    /* Compact breadcrumbs on mobile */
    .mud-breadcrumbs {
        font-size: 0.8rem;
    }

    .mud-breadcrumbs li {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Button groups stack on mobile */
    .mud-button-group-root {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Improve touch targets */
    .mud-button, .mud-icon-button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for action buttons */
    .mud-button-group .mud-button {
        margin: 2px;
    }
}

/* Small tablets and large phones */
@media (min-width: 600px) and (max-width: 959px) {
    .mud-table .mud-table-cell {
        padding: 10px 14px !important;
    }

    .mud-typography-h4 {
        font-size: 1.75rem !important;
    }
}

/* Hide on mobile, show on desktop */
.d-none-mobile {
    display: block;
}

@media (max-width: 599px) {
    .d-none-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.d-mobile-only {
    display: none;
}

@media (max-width: 599px) {
    .d-mobile-only {
        display: block !important;
    }
}

/* Mobile-friendly cards */
@media (max-width: 599px) {
    .mud-paper {
        border-radius: 8px;
    }

    /* Reduce card padding on mobile */
    .mud-paper.pa-4 {
        padding: 12px !important;
    }

    .mud-paper.pa-6 {
        padding: 16px !important;
    }
}

/* Improve stepper on mobile */
@media (max-width: 599px) {
    .mud-stepper {
        padding: 8px !important;
    }

    .mud-step-label-content {
        font-size: 0.85rem;
    }
}

/* Fix overlays on mobile */
.mud-overlay {
    padding: 16px;
}

.mud-overlay .mud-paper {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow: auto;
}

/* Touch-friendly list items */
@media (max-width: 599px) {
    .mud-list-item {
        min-height: 48px;
    }
}

/* Responsive timeline */
@media (max-width: 599px) {
    .mud-timeline-item-content {
        padding: 8px 12px !important;
    }
}

/* Better file upload on mobile */
@media (max-width: 599px) {
    .mud-file-upload {
        width: 100%;
    }

    .mud-file-upload .mud-button {
        width: 100%;
    }
}

/* Floating action button position on mobile */
.fab-mobile {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
}

/* Prevent horizontal scroll on body */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   NAVIGATION & DRAWER STYLES
   ======================================== */

/* Compact drawer on mobile */
@media (max-width: 959px) {
    .mud-drawer.app-drawer {
        width: 280px !important;
        max-width: 85vw !important;
    }

    .mud-drawer.app-drawer.mud-drawer--closed,
    .mud-drawer.app-drawer:not(.mud-drawer--open) {
        left: 0 !important;
        min-width: 0 !important;
        pointer-events: none !important;
        transform: translateX(-105%) !important;
        visibility: hidden !important;
    }

    .mud-drawer.app-drawer.mud-drawer--open {
        pointer-events: auto !important;
        transform: translateX(0) !important;
        visibility: visible !important;
    }

    .mud-drawer-header {
        padding: 12px 16px !important;
        min-height: 52px !important;
        border-bottom: 1px solid var(--mud-palette-divider);
    }

    /* Ensure drawer overlay covers content properly */
    .mud-drawer-overlay {
        background-color: rgba(0, 0, 0, 0.5) !important;
    }

    /* Compact navigation items */
    .mud-nav-link {
        padding: 10px 16px !important;
        min-height: 44px !important;
    }

    .mud-nav-group-text {
        font-size: 0.9rem !important;
    }

    .mud-nav-link-text {
        font-size: 0.875rem !important;
    }

    /* Smaller icons in nav */
    .mud-nav-link .mud-icon-root {
        font-size: 1.25rem !important;
    }
}

@media (max-width: 599px) {
    .mud-drawer.app-drawer {
        width: 260px !important;
    }
}

/* Compact AppBar buttons on mobile */
@media (max-width: 599px) {
    .mud-appbar .mud-icon-button {
        padding: 8px !important;
    }

    .mud-appbar .mud-button {
        padding: 4px 8px !important;
        min-width: auto !important;
    }
}

/* Login display menu on mobile */
@media (max-width: 599px) {
    .mud-menu .mud-menu-item {
        padding: 8px 12px !important;
        min-height: 40px !important;
    }
}

/* ========================================
   DATE PICKER MOBILE STYLES
   ======================================== */

/* Ensure date picker calendar shows all days on mobile */
.mud-picker {
    min-width: 290px !important;
}

.mud-picker-calendar {
    min-width: 280px !important;
}

/* Fix calendar day buttons to ensure all 7 columns fit */
.mud-picker-calendar-day {
    min-width: 36px !important;
    width: 36px !important;
    height: 36px !important;
    margin: 1px !important;
}

/* Ensure the calendar header doesn't get squished */
.mud-picker-calendar-header {
    min-width: 280px !important;
}

/* Mobile-specific date picker adjustments */
@media (max-width: 599px) {
    /* Make the picker dialog take appropriate width */
    .mud-picker-container {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }

    /* Ensure calendar content area has enough space */
    .mud-picker-calendar-content {
        min-width: 280px !important;
        overflow: visible !important;
    }

    /* Slightly smaller day buttons on very small screens */
    .mud-picker-calendar-day {
        min-width: 34px !important;
        width: 34px !important;
        height: 34px !important;
        font-size: 0.8rem !important;
    }

    /* Week day headers */
    .mud-picker-calendar-header-day {
        min-width: 34px !important;
        width: 34px !important;
        font-size: 0.75rem !important;
    }

    /* Calendar transitions wrapper */
    .mud-picker-calendar-transition {
        min-width: 280px !important;
        overflow: visible !important;
    }

    /* Fix month/year selector */
    .mud-picker-toolbar {
        padding: 8px !important;
    }

    /* Ensure picker popover/dialog doesn't get cut off */
    .mud-popover.mud-picker-popover {
        max-width: calc(100vw - 16px) !important;
        left: 8px !important;
        right: 8px !important;
    }

    /* Dialog mode picker - center and size properly */
    .mud-dialog .mud-picker {
        width: 100% !important;
        min-width: unset !important;
    }
}

/* ========================================
   HOME PAGE & HERO STYLES
   ======================================== */

/* Hero section styling */
.hero-section {
    background: linear-gradient(135deg, var(--mud-palette-primary) 0%, #1565c0 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
}

@media (min-width: 600px) {
    .hero-title {
        font-size: 1.75rem !important;
    }
}

@media (min-width: 960px) {
    .hero-title {
        font-size: 2rem !important;
    }
}

/* Action cards */
.action-card {
    border-radius: 12px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* Full height helper */
.h-100 {
    height: 100%;
}

/* Text center helper */
.text-center {
    text-align: center;
}

/* Justify center for card actions */
.justify-center {
    justify-content: center !important;
}

/* Mobile-specific home page adjustments */
@media (max-width: 599px) {
    .hero-section {
        margin: -12px -8px 16px -8px !important;
        border-radius: 0 0 16px 16px !important;
        padding: 24px 16px !important;
    }

    .action-card {
        border-radius: 10px !important;
    }

    .action-card .mud-card-content {
        padding: 16px !important;
    }

    .action-card .mud-card-actions {
        padding: 0 16px 16px 16px !important;
    }

    /* Make buttons full width on mobile */
    .action-card .mud-button {
        width: 100%;
    }
}

/* Small screen timeline improvements */
@media (max-width: 599px) {
    .mud-timeline {
        padding-left: 0 !important;
    }

    .mud-timeline-item {
        padding-bottom: 12px !important;
    }
}
