/* AMS — global UI polish & animations */

:root {
    --ams-primary: #262b40;
    --ams-accent: #17a2b8;
    --ams-success: #10b981;
    --ams-danger: #ef4444;
    --ams-radius: 0.5rem;
    --ams-shadow: 0 4px 14px rgba(38, 43, 64, 0.08);
    --ams-shadow-hover: 0 8px 24px rgba(38, 43, 64, 0.12);
    --ams-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page enter */
@keyframes ams-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ams-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes ams-pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ams-page-content {
    /* Opacity only — transform breaks Bootstrap modals (position: fixed) */
    animation: ams-fade-in 0.45s ease-out both;
}

/* Volt sets overflow:hidden on .content, which breaks in-page modals/backdrops */
main.content {
    overflow: visible;
}

.ams-reports-card {
    animation: ams-fade-in 0.5s ease-out both;
}

.ams-reports-card:hover {
    transform: none;
}

/* Cards */
.card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform var(--ams-transition), box-shadow var(--ams-transition);
}

.card.shadow-sm:hover,
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ams-shadow-hover) !important;
}

.ams-stat-card {
    position: relative;
    overflow: visible;
    border: none !important;
    animation: ams-fade-up 0.5s ease-out both;
}

.ams-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ams-accent), #3dbdd4);
    opacity: 0;
    transition: opacity var(--ams-transition);
}

.ams-stat-card:hover::before {
    opacity: 1;
}

.ams-stat-card:nth-child(1) { animation-delay: 0.05s; }
.ams-stat-card:nth-child(2) { animation-delay: 0.1s; }
.ams-stat-card:nth-child(3) { animation-delay: 0.15s; }
.ams-stat-card:nth-child(4) { animation-delay: 0.2s; }

.ams-stat-card .h3 {
    transition: color var(--ams-transition);
}

.ams-stat-card:hover .h3 {
    color: var(--ams-accent);
}

/* Tables */
.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: rgba(23, 162, 184, 0.06) !important;
}

.table thead th {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Buttons */
.btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary,
.btn-gray-800 {
    box-shadow: 0 2px 6px rgba(38, 43, 64, 0.15);
}

.btn-primary:hover,
.btn-gray-800:hover {
    box-shadow: 0 4px 12px rgba(38, 43, 64, 0.2);
}

.btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn.is-loading .ams-btn-text {
    visibility: hidden;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ams-spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    margin: -0.5rem 0 0 -0.5rem;
}

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

/* Sidebar */
.sidebar .nav-link {
    transition: background-color var(--ams-transition), padding-left var(--ams-transition), color var(--ams-transition);
    border-radius: 0.375rem;
    margin: 0 0.25rem;
}

.sidebar .nav-link:hover {
    padding-left: 1.1rem;
}

.sidebar .nav-link.active {
    box-shadow: inset 3px 0 0 var(--ams-accent);
}

/* Alerts */
.ams-alert {
    animation: ams-slide-down 0.35s ease-out both;
    border: none;
    border-radius: var(--ams-radius);
    box-shadow: var(--ams-shadow);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ams-alert.alert-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
}

.ams-alert.alert-danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
}

.ams-alert.alert-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #92400e;
}

.ams-alert .btn-close {
    flex-shrink: 0;
}

.ams-alert.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--ams-accent);
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.2);
}

.form-control,
.form-select {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Modals */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.modal-dialog {
    pointer-events: auto;
}

.modal-content {
    pointer-events: auto;
}

/* Report tiles */
.report-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 1rem 1.25rem;
    border-radius: var(--ams-radius);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--ams-shadow);
    transition: transform var(--ams-transition), box-shadow var(--ams-transition);
    animation: ams-fade-up 0.45s ease-out both;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.report-tile:hover {
    color: #fff;
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--ams-shadow-hover);
}

.report-tile:nth-child(1) { animation-delay: 0.05s; }
.report-tile:nth-child(2) { animation-delay: 0.1s; }
.report-tile:nth-child(3) { animation-delay: 0.15s; }
.report-tile:nth-child(4) { animation-delay: 0.2s; }
.report-tile:nth-child(5) { animation-delay: 0.25s; }

.report-tile-title {
    font-size: 1rem;
    line-height: 1.3;
    padding-right: 0.5rem;
}

.report-tile-icon {
    opacity: 0.9;
    flex-shrink: 0;
    transition: transform var(--ams-transition);
}

.report-tile:hover .report-tile-icon {
    transform: scale(1.08);
}

.report-tile-orange { background: linear-gradient(135deg, #f5a962, #e8924f); }
.report-tile-teal { background: linear-gradient(135deg, #3dbdd4, #17a2b8); }
.report-tile-green { background: linear-gradient(135deg, #6fdc8c, #3ecf6e); }
.report-tile-pink { background: linear-gradient(135deg, #f07a9a, #e85d82); }

/* Page headers */
.ams-page-header h1 {
    animation: ams-fade-in 0.4s ease-out both;
}

/* Empty states */
.table tbody td.text-center.text-gray-600 {
    padding: 2rem !important;
    font-style: italic;
}

/* Login */
.ams-login-card {
    animation: ams-fade-up 0.55s ease-out both;
    transition: box-shadow var(--ams-transition);
}

.ams-login-card:hover {
    box-shadow: 0 12px 40px rgba(38, 43, 64, 0.12) !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;
    }
}
