/* Contact API Blocks - Frontend Styles */

.contact-api-contact {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.contact-api-contact:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.contact-api-title {
    margin: 0 0 16px 0;
    font-size: 1.5em;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.contact-api-separator {
    height: 2px;
    background: linear-gradient(90deg, #3498db, #2980b9);
    margin: 16px 0 20px 0;
    border-radius: 1px;
}

.contact-api-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-api-field {
    display: flex;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.contact-api-field:last-child {
    border-bottom: none;
}

.contact-api-label {
    font-weight: 600;
    color: #34495e;
    min-width: 140px;
    margin-right: 12px;
    flex-shrink: 0;
}

.contact-api-value {
    color: #2c3e50;
    flex: 1;
    word-break: break-word;
}

/* Search Interface */
.contact-api-search-wrapper {
    margin-bottom: 24px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e1e5e9;
}

.contact-api-search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.contact-api-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.contact-api-search-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.contact-api-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    pointer-events: none;
    font-size: 14px;
}

.contact-api-search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.contact-api-search-clear:hover {
    background: #c0392b;
}

.contact-api-search-results-count {
    text-align: center;
    margin-top: 12px;
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
}

.contact-api-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
    color: #6c757d;
    margin-top: 20px;
}

.contact-api-no-results p {
    margin: 0;
    font-size: 16px;
}

/* All Contacts Layout */
.contact-api-all-contacts-wrapper {
    margin: 24px 0;
}

.contact-api-all-contacts {
    margin: 0;
}

.contact-api-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.contact-api-layout-list .contact-api-contact {
    margin-bottom: 32px;
}

/* Group Headers and Sorting */
.contact-api-group {
    margin-bottom: 32px;
}

.contact-api-group-header {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding: 12px 0 8px 0;
    border-bottom: 3px solid #3498db;
    position: relative;
}

.contact-api-group-header::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #2980b9;
}

.contact-api-group-contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.contact-api-layout-list .contact-api-group-contacts {
    display: block;
}

.contact-api-layout-list .contact-api-group-contacts .contact-api-contact {
    margin-bottom: 24px;
}

/* Error and Loading States */
.contact-api-error {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    color: #c33;
    text-align: center;
    margin: 16px 0;
    animation: error-fade-in 0.3s ease;
}

@keyframes error-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.contact-api-error p {
    margin: 0 0 15px 0;
    font-size: 16px;
    line-height: 1.5;
}

.contact-api-retry-button {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.contact-api-retry-button:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.contact-api-retry-button:active {
    transform: translateY(1px);
}

.contact-api-retry-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.contact-api-loading {
    position: relative;
    min-height: 200px;
    opacity: 0.7;
    pointer-events: none;
}

.contact-api-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: contact-api-spin 1s linear infinite;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes contact-api-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.contact-api-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    color: #6c757d;
    margin: 16px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-api-contact {
        padding: 16px;
        margin-bottom: 16px;
    }

    .contact-api-title {
        font-size: 1.3em;
    }

    .contact-api-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .contact-api-label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 4px;
    }

    .contact-api-layout-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .contact-api-group-contacts {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .contact-api-group-header {
        font-size: 1.5em;
        margin-bottom: 16px;
        padding: 8px 0 6px 0;
    }

    /* Search responsive styles */
    .contact-api-search-wrapper {
        padding: 16px;
        margin-bottom: 20px;
    }

    .contact-api-search-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
        padding: 10px 40px 10px 12px;
    }

    .contact-api-search-clear {
        width: 22px;
        height: 22px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .contact-api-contact {
        padding: 12px;
    }

    .contact-api-title {
        font-size: 1.2em;
        margin-bottom: 12px;
    }

    .contact-api-separator {
        margin: 12px 0 16px 0;
    }
}

/* Field Type Specific Styles */
.contact-api-field-email a,
.contact-api-field-url a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-api-field-email a:hover,
.contact-api-field-url a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.contact-api-field-image {
    align-items: center;
    transition: opacity 0.3s ease;
    position: relative;
}

.contact-api-field-image img {
    max-width: 200px;
    max-height: 150px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


.contact-api-field-image.loaded {
    opacity: 1;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.contact-api-field-url .contact-api-value::after {
    content: " ↗";
    color: #7f8c8d;
    font-size: 0.8em;
}

.contact-api-field-html {
    align-items: flex-start;
}

.contact-api-field-html .contact-api-value {
    line-height: 1.5;
}

.contact-api-field-html .contact-api-value p {
    margin: 0 0 8px 0;
}

.contact-api-field-html .contact-api-value ul,
.contact-api-field-html .contact-api-value ol {
    margin: 8px 0;
    padding-left: 20px;
}

.contact-api-field-html .contact-api-value li {
    margin-bottom: 4px;
}

.contact-api-field-html .contact-api-value a {
    color: #3498db;
    text-decoration: none;
}

.contact-api-field-html .contact-api-value a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Print Styles */
@media print {
    .contact-api-contact {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
        margin-bottom: 20px;
    }

    .contact-api-separator {
        background: #ccc !important;
    }

    .contact-api-layout-grid {
        display: block;
    }

    /* Print adjustments for new field types */
    .contact-api-field-email a,
    .contact-api-field-url a {
        color: #000 !important;
        text-decoration: underline;
    }

    .contact-api-field-image img {
        max-width: 150px;
        max-height: 100px;
    }

    /* Print styles for group headers */
    .contact-api-group {
        break-inside: avoid;
        margin-bottom: 20px;
    }

    .contact-api-group-header {
        font-size: 1.4em;
        border-bottom: 2px solid #000 !important;
        margin-bottom: 15px;
        break-after: avoid;
    }

    .contact-api-group-header::before {
        background: #000 !important;
    }

    .contact-api-group-contacts {
        display: block !important;
    }

    /* Hide search interface when printing */
    .contact-api-search-wrapper {
        display: none !important;
    }

    .contact-api-no-results {
        display: none !important;
    }
}

/* Smooth Transitions */
.contact-api-contact {
    transition: all 0.3s ease-in-out;
}

.contact-api-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Search Interface */
.contact-api-search {
    margin-bottom: 20px;
}

.contact-api-search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.contact-api-search-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* Contact Cards */
.contact-api-contact {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.contact-api-title {
    color: #2c3e50;
    font-size: 1.5em;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.contact-api-field {
    margin: 10px 0;
    display: flex;
    align-items: flex-start;
}

.contact-api-label {
    font-weight: 600;
    color: #666;
    min-width: 120px;
    margin-right: 10px;
}

.contact-api-value {
    color: #333;
    flex: 1;
}

/* Links and Interactive Elements */
.contact-api-email,
.contact-api-url,
.contact-api-phone {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-api-email:hover,
.contact-api-url:hover,
.contact-api-phone:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Images */
.contact-api-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

/* HTML Content */
.contact-api-html {
    line-height: 1.6;
}

.contact-api-html ul {
    margin: 10px 0;
    padding-left: 20px;
}

.contact-api-html li {
    margin: 5px 0;
}

/* Grid Layout */
.contact-api-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* List Layout */
.contact-api-layout-list .contact-api-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.contact-api-layout-list .contact-api-title {
    flex: 0 0 100%;
    margin-bottom: 10px;
}

.contact-api-layout-list .contact-api-field {
    flex: 0 0 50%;
    margin: 5px 0;
}

/* Group Headers */
.contact-api-group {
    margin-bottom: 30px;
}

.contact-api-group-header {
    color: #2c3e50;
    font-size: 1.8em;
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #3498db;
}

/* No Results Message */
.contact-api-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    color: #666;
}

/* Accessibility */
.contact-api-contact:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}

.contact-api-contact a:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    text-decoration: underline;
}

/* Print Styles */
@media print {

    .contact-api-search,
    .contact-api-group-header {
        display: none;
    }

    .contact-api-contact {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Notice Styles */
.notice {
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 4px;
    display: none;
    animation: notice-fade-in 0.3s ease;
}

@keyframes notice-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.notice-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notice-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Enhanced Search Results Count */
.contact-api-search-results-count {
    margin: 10px 0;
    font-size: 0.9em;
    color: #666;
    display: none;
    animation: fade-in 0.3s ease;
}

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

    to {
        opacity: 1;
    }
}

/* Fix layout when labels are hidden */
.contact-api-field:not(:has(.contact-api-label)) .contact-api-value {
    flex: 1 1 100%;
    margin-left: 0;
    min-width: 0;
}

/* For better browser support, fallback: if .contact-api-label is hidden, .contact-api-value should take full width */
.contact-api-label[style*="display: none"]+.contact-api-value,
.contact-api-label[hidden]+.contact-api-value {
    flex: 1 1 100%;
    margin-left: 0;
    min-width: 0;
}