/**
 * ACC System - Public Frontend Styles
 * Design System: "Premium Security"
 * 
 * Dependencies: acc-ui.css (defines variables)
 */

/* --- Component: Wizards (Multi-step Forms) --- */
.acc-wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--acc-space-xl);
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.acc-wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--acc-border);
    z-index: 1;
    transform: translateY(-50%);
}

/* ===================================
   FLOATING LABEL SEARCH INPUT
   =================================== */

/* Floating label animation */
#acc-search-input:focus+label,
#acc-search-input:not(:placeholder-shown)+label {
    top: -10px;
    font-size: 12px;
    transform: translateY(0);
    color: var(--acc-primary);
}

#acc-search-input:focus {
    outline: 2px solid var(--acc-primary);
    outline-offset: 0;
    border-color: transparent;
}

/* Clear button hover */
#acc-clear-search:hover {
    color: var(--acc-danger);
}

/* ===================================
   ANIMATIONS & MICRO-INTERACTIONS
   =================================== */
.acc-wizard-step-dot {
    width: 2.5rem;
    /* 40px */
    height: 2.5rem;
    background: var(--acc-surface);
    border: 2px solid var(--acc-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-weight: 600;
    color: var(--acc-text-muted);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.acc-wizard-step-dot.active {
    border-color: var(--acc-primary);
    background: var(--acc-primary);
    color: var(--acc-text-inverse);
    box-shadow: 0 0 0 4px rgba(10, 25, 47, 0.15);
    transform: scale(1.1);
}

.acc-wizard-step-dot.completed {
    background: var(--acc-success);
    border-color: var(--acc-success);
    color: var(--acc-text-inverse);
}

.acc-step-content {
    display: none;
    animation: accFadeIn 0.4s ease forwards;
}

.acc-step-content.active {
    display: block;
}

@keyframes accFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Component: Tables --- */
.acc-table-wrapper {
    overflow-x: auto;
    background: var(--acc-surface);
    border-radius: var(--acc-radius-md);
    box-shadow: var(--acc-shadow-sm);
    border: 1px solid var(--acc-border);
}

.acc-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Ensure it doesn't squish on mobile */
}

.acc-table thead {
    background: var(--acc-primary);
    color: var(--acc-text-inverse);
}

.acc-table th {
    padding: var(--acc-space-md);
    text-align: left;
    font-weight: 600;
    font-size: var(--acc-font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.acc-table td {
    padding: var(--acc-space-md);
    border-bottom: 1px solid var(--acc-border-light);
    color: var(--acc-text-main);
}

.acc-table tbody tr:last-child td {
    border-bottom: none;
}

.acc-table tbody tr:hover {
    background-color: var(--acc-bg);
}

/* --- Component: Dashboard Header --- */
.acc-dashboard-header {
    background: linear-gradient(135deg, var(--acc-primary) 0%, var(--acc-primary-light) 100%);
    color: var(--acc-text-inverse);
    padding: var(--acc-space-xl);
    border-radius: var(--acc-radius-lg);
    margin-bottom: var(--acc-space-xl);
    box-shadow: var(--acc-shadow-md);
    position: relative;
    overflow: hidden;
}

.acc-dashboard-header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.05) 0%, transparent 20%);
    pointer-events: none;
}

.acc-dashboard-welcome h2 {
    color: var(--acc-text-inverse);
    margin: 0 0 var(--acc-space-sm) 0;
    font-size: var(--acc-font-size-2xl);
}

.acc-dashboard-welcome p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* --- Component: Empty State --- */
.acc-empty-state {
    text-align: center;
    padding: var(--acc-space-2xl) var(--acc-space-lg);
    background: var(--acc-bg);
    border-radius: var(--acc-radius-md);
    border: 2px dashed var(--acc-border);
}

.acc-empty-icon {
    font-size: 3rem;
    color: var(--acc-text-muted);
    margin-bottom: var(--acc-space-md);
    display: block;
    opacity: 0.5;
}

.acc-empty-state h3 {
    margin-bottom: var(--acc-space-sm);
    color: var(--acc-text-main);
}

.acc-empty-state p {
    color: var(--acc-text-muted);
    margin-bottom: var(--acc-space-lg);
}

/* --- Component: Incident Card (List View) --- */
.acc-incident-listing {
    display: flex;
    flex-direction: column;
    gap: var(--acc-space-md);
}

.acc-incident-item {
    background: var(--acc-surface);
    border: 1px solid var(--acc-border);
    border-radius: var(--acc-radius-md);
    padding: var(--acc-space-md);
    transition: all 0.2s ease;
    border-left: 4px solid var(--acc-primary);
}

.acc-incident-item:hover {
    box-shadow: var(--acc-shadow-md);
    transform: translateX(4px);
}

/* --- Component: Alerts (Override/Extension) --- */
.acc-alert {
    padding: var(--acc-space-md);
    border-radius: var(--acc-radius-md);
    margin-bottom: var(--acc-space-md);
    border-left: 4px solid;
    font-size: var(--acc-font-size-sm);
}

.acc-alert-info {
    background-color: #e3f2fd;
    border-color: var(--acc-info);
    color: #0d47a1;
}

.acc-alert-success {
    background-color: #e8f5e9;
    border-color: var(--acc-success);
    color: #1b5e20;
}

.acc-alert-warning {
    background-color: #fff8e1;
    border-color: var(--acc-warning);
    color: #f57f17;
}

.acc-alert-error {
    background-color: #ffebee;
    border-color: var(--acc-danger);
    color: #b71c1c;
}

/* --- Safety Intelligence --- */
.acc-playbook-card {
    border-top: 4px solid var(--acc-danger);
    background: #fff;
}

/* --- Component: Accordion (Playbook) --- */
.acc-playbook-summary {
    cursor: pointer;
    color: var(--acc-text-main);
    font-weight: 600;
    padding: var(--acc-space-md);
    background: var(--acc-bg);
    border-radius: var(--acc-radius-md);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    list-style: none;
    margin-bottom: 0;
}

.acc-playbook-summary::-webkit-details-marker {
    display: none;
}

.acc-playbook-summary:hover {
    background: var(--acc-border-light);
    color: var(--acc-primary);
}

.acc-playbook-summary::after {
    content: '+';
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 400;
    color: var(--acc-text-muted);
    transition: transform 0.2s ease;
}

details[open] .acc-playbook-summary {
    background: var(--acc-primary);
    color: var(--acc-text-inverse);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

details[open] .acc-playbook-summary:hover {
    background: var(--acc-primary-light);
}

details[open] .acc-playbook-summary::after {
    transform: rotate(45deg);
    color: var(--acc-text-inverse);
}

/* Content adjustment when open */
details[open]>div {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-top: 0 !important;
    /* Override acc-mt-md */
    border: 1px solid var(--acc-border);
    border-top: none;
}

.acc-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.acc-tips-item {
    border-bottom: 1px solid var(--acc-border-light);
    padding-bottom: var(--acc-space-sm);
    margin-bottom: var(--acc-space-sm);
}

.acc-tips-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.acc-tips-link {
    text-decoration: none;
    font-weight: 500;
    color: var(--acc-text-main);
    display: block;
    margin-bottom: 2px;
}


.acc-tips-link:hover {
    color: var(--acc-primary);
}

/* --- Component: Premium Loader --- */
.acc-svg-loader {
    width: 6em;
    height: 6em;
    color: var(--acc-primary);
    /* Default color context */
}

.acc-svg-loader__ring {
    animation: accRingA 2s linear infinite;
}

.acc-svg-loader__ring--a {
    stroke: var(--acc-primary);
}

.acc-svg-loader__ring--b {
    animation-name: accRingB;
    stroke: var(--acc-secondary);
}

.acc-svg-loader__ring--c {
    animation-name: accRingC;
    stroke: var(--acc-text-muted);
}

.acc-svg-loader__ring--d {
    animation-name: accRingD;
    stroke: var(--acc-primary);
}

/* Animations */
@keyframes accRingA {

    from,
    4% {
        stroke-dasharray: 0 660;
        stroke-width: 20;
        stroke-dashoffset: -330;
    }

    12% {
        stroke-dasharray: 60 600;
        stroke-width: 30;
        stroke-dashoffset: -335;
    }

    32% {
        stroke-dasharray: 60 600;
        stroke-width: 30;
        stroke-dashoffset: -595;
    }

    40%,
    54% {
        stroke-dasharray: 0 660;
        stroke-width: 20;
        stroke-dashoffset: -660;
    }

    62% {
        stroke-dasharray: 60 600;
        stroke-width: 30;
        stroke-dashoffset: -665;
    }

    82% {
        stroke-dasharray: 60 600;
        stroke-width: 30;
        stroke-dashoffset: -925;
    }

    90%,
    to {
        stroke-dasharray: 0 660;
        stroke-width: 20;
        stroke-dashoffset: -990;
    }
}

@keyframes accRingB {

    from,
    12% {
        stroke-dasharray: 0 220;
        stroke-width: 20;
        stroke-dashoffset: -110;
    }

    20% {
        stroke-dasharray: 20 200;
        stroke-width: 30;
        stroke-dashoffset: -115;
    }

    40% {
        stroke-dasharray: 20 200;
        stroke-width: 30;
        stroke-dashoffset: -195;
    }

    48%,
    62% {
        stroke-dasharray: 0 220;
        stroke-width: 20;
        stroke-dashoffset: -220;
    }

    70% {
        stroke-dasharray: 20 200;
        stroke-width: 30;
        stroke-dashoffset: -225;
    }

    90% {
        stroke-dasharray: 20 200;
        stroke-width: 30;
        stroke-dashoffset: -305;
    }

    98%,
    to {
        stroke-dasharray: 0 220;
        stroke-width: 20;
        stroke-dashoffset: -330;
    }
}

@keyframes accRingC {
    from {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: 0;
    }

    8% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -5;
    }

    28% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -175;
    }

    36%,
    58% {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: -220;
    }

    66% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -225;
    }

    86% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -395;
    }

    94%,
    to {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: -440;
    }
}

@keyframes accRingD {

    from,
    8% {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: 0;
    }

    16% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -5;
    }

    36% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -175;
    }

    44%,
    50% {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: -220;
    }

    58% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -225;
    }

    78% {
        stroke-dasharray: 40 400;
        stroke-width: 30;
        stroke-dashoffset: -395;
    }

    86%,
    to {
        stroke-dasharray: 0 440;
        stroke-width: 20;
        stroke-dashoffset: -440;
    }
}

/* --- Premium Animations --- */
@keyframes accSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes accPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.acc-fade-in {
    animation: accFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.acc-slide-up {
    animation: accSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Apply animations to key elements */
.acc-dashboard-header {
    animation: accFadeIn 0.8s ease-out forwards;
}

.acc-card,
.acc-incident-item {
    animation: accSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

/* Stagger Animations for Grids */
.acc-grid .acc-card:nth-child(1) {
    animation-delay: 0.1s;
}

.acc-grid .acc-card:nth-child(2) {
    animation-delay: 0.2s;
}

.acc-grid .acc-card:nth-child(3) {
    animation-delay: 0.3s;
}

.acc-grid .acc-card:nth-child(4) {
    animation-delay: 0.4s;
}

.acc-grid .acc-card:nth-child(5) {
    animation-delay: 0.5s;
}

.acc-incident-listing .acc-incident-item:nth-child(1) {
    animation-delay: 0.1s;
}

.acc-incident-listing .acc-incident-item:nth-child(2) {
    animation-delay: 0.2s;
}

.acc-incident-listing .acc-incident-item:nth-child(3) {
    animation-delay: 0.3s;
}

.acc-incident-listing .acc-incident-item:nth-child(4) {
    animation-delay: 0.4s;
}

.acc-incident-listing .acc-incident-item:nth-child(5) {
    animation-delay: 0.5s;
}

/* Interactive Elements */
.acc-btn {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, background-color 0.2s ease;
}

.acc-btn:active {
    transform: scale(0.98);
}

.acc-input:focus,
.acc-select:focus,
.acc-textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Incident Form Overrides */
#acc-report-app .acc-card .acc-card-header {
    display: none;
}

/* Acc card */
#acc-report-app>.acc-card {
    border-style: none;
}