/* ===================================
   ADDITIONAL ENHANCEMENTS & UTILITIES
   =================================== */

/**
 * Loading Spinner
 */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/**
 * Fade in animation
 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/**
 * Badge styling
 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-light);
    color: white;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-info {
    background: var(--info-color);
    color: white;
}

.badge-secondary {
    background: var(--secondary-color);
    color: white;
}

/**
 * Card component
 */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem;
    background: var(--light-bg);
    border-bottom: 1px solid var(--light-border);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--light-bg);
    border-top: 1px solid var(--light-border);
}

/**
 * Progress Bar
 */
.progress {
    height: 8px;
    background: var(--light-border);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.3s ease;
    border-radius: 4px;
}

/**
 * Modal backdrop
 */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    animation: fadeIn 0.3s ease;
}

.modal-backdrop.show {
    display: block;
}

/**
 * Tooltip
 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    white-space: nowrap;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/**
 * Breadcrumb
 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    list-style: none;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin: 0 0.5rem;
    color: var(--gray-text);
}

.breadcrumb a {
    color: var(--primary-color);
}

.breadcrumb li:last-child {
    color: var(--gray-text);
}

/**
 * Divider
 */
.divider {
    margin: 2rem 0;
    border: none;
    border-top: 2px solid var(--light-border);
}

.divider.text::after {
    content: attr(data-content);
    position: relative;
    top: -12px;
    padding: 0 1rem;
    background: white;
    color: var(--gray-text);
}

/**
 * Section spacing
 */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark-text);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/**
 * Grid utilities
 */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/**
 * Flex utilities
 */
.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/**
 * Text utilities
 */
.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-uppercase {
    text-transform: uppercase;
}

.text-lowercase {
    text-transform: lowercase;
}

.text-capitalize {
    text-transform: capitalize;
}

.line-through {
    text-decoration: line-through;
}

.underline {
    text-decoration: underline;
}

/**
 * Display utilities
 */
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }

/**
 * Position utilities
 */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/**
 * Shadow utilities
 */
.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/**
 * Opacity utilities
 */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/**
 * Border utilities
 */
.border {
    border: 1px solid var(--light-border);
}

.border-top {
    border-top: 1px solid var(--light-border);
}

.border-bottom {
    border-bottom: 1px solid var(--light-border);
}

.border-primary {
    border-color: var(--primary-color);
}

.rounded {
    border-radius: 8px;
}

.rounded-lg {
    border-radius: 12px;
}

.rounded-full {
    border-radius: 9999px;
}

/**
 * Overflow utilities
 */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/**
 * Clear utilities
 */
.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

/**
 * Transform utilities
 */
.rotate-90 { transform: rotate(90deg); }
.rotate-180 { transform: rotate(180deg); }
.rotate-270 { transform: rotate(270deg); }

.scale-75 { transform: scale(0.75); }
.scale-100 { transform: scale(1); }
.scale-125 { transform: scale(1.25); }

/**
 * Focus visible
 */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/**
 * Selection
 */
::selection {
    background: var(--primary-light);
    color: white;
}

::-moz-selection {
    background: var(--primary-light);
    color: white;
}

/**
 * Scrollbar styling (Webkit browsers)
 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--light-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/**
 * Form validation states
 */
.form-group.focused label {
    color: var(--primary-color);
    font-weight: 600;
}

.form-group.filled input,
.form-group.filled textarea,
.form-group.filled select {
    border-color: var(--primary-color);
}

input:invalid,
textarea:invalid,
select:invalid {
    border-color: var(--danger-color);
}

input:valid,
textarea:valid,
select:valid {
    border-color: var(--success-color);
}

/**
 * Animations
 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/**
 * Print styles
 */
@media print {
    body {
        background: white;
    }

    .top-nav,
    .sidebar,
    .sidebar-toggle-btn,
    .btn,
    .footer,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
        color: black;
    }

    table {
        border-collapse: collapse;
    }

    table, th, td {
        border: 1px solid #ddd;
    }

    th, td {
        padding: 8px;
        text-align: left;
    }

    th {
        background-color: #f2f2f2;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .page-break {
        page-break-before: always;
    }
}

/**
 * Dark mode support (future)
 */
@media (prefers-color-scheme: dark) {
    /* Can be implemented in future */
}
