﻿/* Utility Classes */

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }

    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }

    70% {
        transform: translate3d(0, -4px, 0);
    }

    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}

.animate-bounce {
    animation: bounce 1s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Transition Classes */
.transition-all {
    transition: all 0.3s ease;
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

.transition-colors {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.transition-transform {
    transition: transform 0.3s ease;
}

.transition-opacity {
    transition: opacity 0.3s ease;
}

/* Hover Effects */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-bright:hover {
    filter: brightness(1.1);
}

.hover-shadow:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Focus States */
.focus-visible:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.25);
}

/* Text Utilities */
.text-primary-blue {
    color: var(--primary-blue) !important;
}

.text-dark-blue {
    color: var(--dark-blue) !important;
}

.text-light-blue {
    color: var(--light-blue) !important;
}

.text-medium-gray {
    color: var(--medium-gray) !important;
}

.text-admin-gold {
    color: var(--admin-gold) !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-break {
    word-break: break-word;
}

/* Background Utilities */
.bg-primary-blue {
    background-color: var(--primary-blue) !important;
}

.bg-light-blue {
    background-color: var(--light-blue) !important;
}

.bg-dark-blue {
    background-color: var(--dark-blue) !important;
}

.bg-light-gray {
    background-color: var(--light-gray) !important;
}

.bg-admin-gold {
    background-color: var(--admin-gold) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue)) !important;
}

.bg-gradient-admin {
    background: linear-gradient(135deg, var(--admin-gold), var(--warning-orange)) !important;
}

/* Border Utilities */
.border-primary-blue {
    border-color: var(--primary-blue) !important;
}

.border-light-blue {
    border-color: var(--light-blue) !important;
}

.border-rounded {
    border-radius: 8px !important;
}

.border-rounded-lg {
    border-radius: 12px !important;
}

.border-rounded-xl {
    border-radius: 16px !important;
}

/* Shadow Utilities */
.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.shadow-md {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1) !important;
}

.shadow-xl {
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1) !important;
}

.shadow-inner {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.shadow-none {
    box-shadow: none !important;
}

/* Display Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-start {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.flex-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-nowrap {
    flex-wrap: nowrap;
}

/* Positioning Utilities */
.relative {
    position: relative !important;
}

.absolute {
    position: absolute !important;
}

.fixed {
    position: fixed !important;
}

.sticky {
    position: sticky !important;
}

.top-0 {
    top: 0 !important;
}

.right-0 {
    right: 0 !important;
}

.bottom-0 {
    bottom: 0 !important;
}

.left-0 {
    left: 0 !important;
}

/* Z-index Utilities */
.z-10 {
    z-index: 10 !important;
}

.z-20 {
    z-index: 20 !important;
}

.z-30 {
    z-index: 30 !important;
}

.z-40 {
    z-index: 40 !important;
}

.z-50 {
    z-index: 50 !important;
}

/* Overflow Utilities */
.overflow-hidden {
    overflow: hidden !important;
}

.overflow-visible {
    overflow: visible !important;
}

.overflow-scroll {
    overflow: scroll !important;
}

.overflow-auto {
    overflow: auto !important;
}

.overflow-x-hidden {
    overflow-x: hidden !important;
}

.overflow-y-hidden {
    overflow-y: hidden !important;
}

.overflow-x-scroll {
    overflow-x: scroll !important;
}

.overflow-y-scroll {
    overflow-y: scroll !important;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--light-blue);
    border-radius: 4px;
}

    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background: var(--primary-blue);
    }

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading-overlay {
    position: relative;
}

    .loading-overlay::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.8);
        z-index: 100;
    }

    .loading-overlay::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 24px;
        height: 24px;
        margin: -12px 0 0 -12px;
        border: 2px solid var(--light-blue);
        border-top: 2px solid var(--primary-blue);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        z-index: 101;
    }

/* Disabled State */
.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive Utilities */
@media (max-width: 576px) {
    .sm-hidden {
        display: none !important;
    }

    .sm-flex-column {
        flex-direction: column !important;
    }

    .sm-text-center {
        text-align: center !important;
    }

    .sm-full-width {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .md-hidden {
        display: none !important;
    }

    .md-flex-column {
        flex-direction: column !important;
    }

    .md-text-center {
        text-align: center !important;
    }

    .md-full-width {
        width: 100% !important;
    }
}

@media (max-width: 992px) {
    .lg-hidden {
        display: none !important;
    }

    .lg-flex-column {
        flex-direction: column !important;
    }

    .lg-text-center {
        text-align: center !important;
    }

    .lg-full-width {
        width: 100% !important;
    }
}

/* Accessibility Utilities */
.sr-only {
    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;
}

.focus-visible:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .text-medium-gray {
        color: #000000 !important;
    }

    .border-light-blue {
        border-color: #000000 !important;
    }

    .shadow-sm,
    .shadow-md,
    .shadow-lg,
    .shadow-xl {
        box-shadow: 0 0 0 1px #000000 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-fade-in,
    .animate-fade-out,
    .animate-slide-in-left,
    .animate-slide-in-right,
    .animate-slide-up,
    .animate-bounce,
    .animate-pulse,
    .animate-spin {
        animation: none !important;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    .dashboard-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }

    .navbar {
        display: none !important;
    }

    .btn {
        display: none !important;
    }

    .alert {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-gray: #1a1a1a;
        --medium-gray: #888888;
        --dark-gray: #ffffff;
    }

    .dashboard-card {
        background: #2d2d2d;
        color: #ffffff;
    }

    .form-control {
        background: #3d3d3d;
        border-color: #555555;
        color: #ffffff;
    }

        .form-control:focus {
            background: #4d4d4d;
            border-color: var(--primary-blue);
        }

    .alert-danger {
        background: rgba(220, 53, 69, 0.2);
        color: #ff6b6b;
    }

    .alert-success {
        background: rgba(40, 167, 69, 0.2);
        color: #51cf66;
    }

    .alert-warning {
        background: rgba(255, 193, 7, 0.2);
        color: #ffd43b;
    }

    .alert-info {
        background: rgba(46, 134, 193, 0.2);
        color: #74c0fc;
    }
}

/* Custom Properties for Dynamic Theming */
.theme-primary {
    --theme-color: var(--primary-blue);
    --theme-color-dark: var(--dark-blue);
    --theme-color-light: var(--light-blue);
}

.theme-admin {
    --theme-color: var(--admin-gold);
    --theme-color-dark: var(--warning-orange);
    --theme-color-light: #ffd93d;
}

.theme-success {
    --theme-color: var(--success-green);
    --theme-color-dark: #1e7e34;
    --theme-color-light: #51cf66;
}

.theme-danger {
    --theme-color: var(--danger-red);
    --theme-color-dark: #a71e2b;
    --theme-color-light: #ff6b6b;
}

/* Utility Classes Using Theme Colors */
.text-theme {
    color: var(--theme-color) !important;
}

.text-theme-dark {
    color: var(--theme-color-dark) !important;
}

.text-theme-light {
    color: var(--theme-color-light) !important;
}

.bg-theme {
    background-color: var(--theme-color) !important;
}

.bg-theme-dark {
    background-color: var(--theme-color-dark) !important;
}

.bg-theme-light {
    background-color: var(--theme-color-light) !important;
}

.border-theme {
    border-color: var(--theme-color) !important;
}

.border-theme-dark {
    border-color: var(--theme-color-dark) !important;
}

.border-theme-light {
    border-color: var(--theme-color-light) !important;
}
