/**
 * Accessible Components CSS
 *
 * Styles for reusable accessible UI components
 *
 * @package ComplySpec_Accessible
 */

/*
==========================================================================
ACCORDION COMPONENT
==========================================================================
*/

.complyspec-accordion {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.accordion-item {
    border-bottom: 1px solid #e5e7eb;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: #ffffff;
    border: none;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.accordion-button:hover {
    background-color: #f9fafb;
}

.accordion-button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.accordion-button[aria-expanded="true"] {
    background-color: #f3f4f6;
}

.accordion-icon {
    transition: transform 0.3s;
    font-size: 0.875rem;
}

.accordion-button[aria-expanded="true"] .accordion-icon {
    transform: rotate(180deg);
}

.accordion-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.accordion-panel:not([hidden]) {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

.accordion-content {
    padding: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .accordion-panel,
    .accordion-icon {
        transition: none;
    }
}

/*
==========================================================================
TABS COMPONENT
==========================================================================
*/

.complyspec-tabs {
    margin-bottom: 2rem;
}

.complyspec-tabs [role="tablist"] {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.complyspec-tabs [role="tab"] {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    position: relative;
    top: 2px;
}

.complyspec-tabs [role="tab"]:hover {
    color: #2563eb;
}

.complyspec-tabs [role="tab"][aria-selected="true"] {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.complyspec-tabs [role="tab"]:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.complyspec-tabs [role="tabpanel"] {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.complyspec-tabs [role="tabpanel"]:focus {
    outline: none;
}

/*
==========================================================================
MODAL DIALOG COMPONENT
==========================================================================
*/

.complyspec-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.modal-small .modal-content { max-width: 400px; width: 100%; }
.modal-medium .modal-content { max-width: 600px; width: 100%; }
.modal-large .modal-content { max-width: 900px; width: 100%; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #6b7280;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #111827;
}

.modal-close:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.modal-body {
    padding: 1.5rem;
}

/* Modal entrance animation */
.complyspec-modal:not([hidden]) {
    animation: modalFadeIn 0.3s ease-out;
}

.complyspec-modal:not([hidden]) .modal-content {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .complyspec-modal:not([hidden]),
    .complyspec-modal:not([hidden]) .modal-content {
        animation: none;
    }
}

/*
==========================================================================
TOOLTIP COMPONENT
==========================================================================
*/

.complyspec-tooltip-wrapper {
    position: relative;
    display: inline-block;
}

[data-tooltip] {
    cursor: help;
    border-bottom: 1px dotted currentColor;
}

.tooltip {
    position: absolute;
    z-index: 1000;
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: #ffffff;
    font-size: 0.875rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}

.tooltip::after {
    content: '';
    position: absolute;
    border: 5px solid transparent;
}

/* Tooltip positions */
.tooltip-top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
}

.tooltip-top::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #1f2937;
}

.tooltip-right {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
}

.tooltip-right::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #1f2937;
}

.tooltip-bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
}

.tooltip-bottom::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #1f2937;
}

.tooltip-left {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
}

.tooltip-left::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #1f2937;
}

[data-tooltip]:hover + .tooltip,
[data-tooltip]:focus + .tooltip {
    display: block;
}

/*
==========================================================================
PROGRESS BAR COMPONENT
==========================================================================
*/

.complyspec-progress {
    margin-bottom: 1.5rem;
}

.progress-label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.progress-bar {
    width: 100%;
    height: 2rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #2563eb;
    transition: width 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-text {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Progress colors */
.progress-primary .progress-fill { background-color: #2563eb; }
.progress-success .progress-fill { background-color: #10b981; }
.progress-warning .progress-fill { background-color: #f59e0b; }
.progress-danger .progress-fill { background-color: #ef4444; }

@media (prefers-reduced-motion: reduce) {
    .progress-fill {
        transition: none;
    }
}

/*
==========================================================================
ALERT COMPONENT
==========================================================================
*/

.complyspec-alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-dismiss {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-dismiss:hover {
    opacity: 1;
}

.alert-dismiss:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Alert types */
.alert-success {
    background-color: #d1fae5;
    border: 2px solid #10b981;
    color: #065f46;
}

.alert-info {
    background-color: #dbeafe;
    border: 2px solid #3b82f6;
    color: #1e3a8a;
}

.alert-warning {
    background-color: #fef3c7;
    border: 2px solid #f59e0b;
    color: #92400e;
}

.alert-error {
    background-color: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

/*
==========================================================================
CARD COMPONENT
==========================================================================
*/

.complyspec-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.complyspec-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.complyspec-card:hover .card-image img {
    transform: scale(1.05);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.card-title a {
    color: inherit;
    text-decoration: none;
}

.card-title a:hover {
    color: #2563eb;
}

.card-title a:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.card-content {
    margin-bottom: 1rem;
    color: #6b7280;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.card-link:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
}

@media (prefers-reduced-motion: reduce) {
    .complyspec-card,
    .card-image img {
        transition: none;
    }

    .complyspec-card:hover {
        transform: none;
    }
}

/*
==========================================================================
RESPONSIVE UTILITIES
==========================================================================
*/

@media (max-width: 768px) {
    .accordion-button {
        padding: 1rem;
        font-size: 1rem;
    }

    .accordion-content {
        padding: 1rem;
    }

    .complyspec-tabs [role="tablist"] {
        flex-direction: column;
        border-bottom: none;
    }

    .complyspec-tabs [role="tab"] {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #e5e7eb;
        border-left: 3px solid transparent;
        top: 0;
    }

    .complyspec-tabs [role="tab"][aria-selected="true"] {
        border-bottom-color: #e5e7eb;
        border-left-color: #2563eb;
    }

    .modal-content {
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }
}
