/* ========================================
   UI Components & Interactive Elements
   ======================================== */

/* Form Validation Styles */
.form-group input.error,
.form-group textarea.error,
.form-group select.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.error-message {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: slideDown 0.3s ease-out;
}

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

/* Message Popup */
.message-popup {
    position: fixed;
    top: 100px;
    right: 20px;
    max-width: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 10000;
    transform: translateX(420px);
    transition: transform 0.3s ease-out;
}

.message-popup.show {
    transform: translateX(0);
}

.message-popup .message-content {
    display: flex;
    align-items: center;
    padding: 20px;
}

.message-popup .message-icon {
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

.message-popup.success {
    border-left: 4px solid #28a745;
}

.message-popup.success .message-icon {
    color: #28a745;
}

.message-popup.error {
    border-left: 4px solid #dc3545;
}

.message-popup.error .message-icon {
    color: #dc3545;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.95);
    color: white;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
}

.cookie-content p {
    flex: 1;
    margin: 0;
    color: #ccc;
}

.cookie-content a {
    color: var(--primary-green);
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 15px;
}

.cookie-buttons .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-green);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Header States */
header.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

header.hidden {
    transform: translateY(-100%);
    transition: transform 0.3s ease-out;
}

/* Lazy Loading Images */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img.loaded {
    opacity: 1;
}

/* Menu Open State */
body.menu-open {
    overflow: hidden;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-green);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 15px 0;
    background: var(--light-gray);
}

.breadcrumbs-list {
    display: flex;
    align-items: center;
    list-style: none;
    flex-wrap: wrap;
}

.breadcrumbs-list li {
    display: flex;
    align-items: center;
}

.breadcrumbs-list li:not(:last-child)::after {
    content: '›';
    margin: 0 10px;
    color: var(--text-gray);
}

.breadcrumbs-list a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumbs-list a:hover {
    color: var(--primary-green);
}

.breadcrumbs-list .current {
    color: var(--primary-green);
    font-weight: 500;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-green);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(45, 90, 61, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-green);
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(45, 90, 61, 0.4);
}

/* Accordion */
.accordion-item {
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    background: var(--light-gray);
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.accordion-header:hover {
    background: #e8e8e8;
}

.accordion-header h3 {
    margin: 0;
    font-size: 18px;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
    padding: 20px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--accent-green));
    border-radius: 4px;
    transition: width 1s ease-out;
}

/* Responsive Tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-gray);
}

table th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--text-dark);
}

table tbody tr:hover {
    background: #f9f9f9;
}

/* Mobile Responsive Components */
@media (max-width: 768px) {
    .message-popup {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    table {
        font-size: 14px;
    }

    table th,
    table td {
        padding: 8px;
    }
}