@use '../globals' as *;

/**
 * Settings Page Styles
 *
 * Styles for the plugin settings page with tabbed interface.
 *
 * @package MultilingualPressZone
 * @since 1.0.0
 */

.international-press-zone-settings {
    max-width: 1200px;
    margin: 0 auto;
    padding: $spacing-lg;

    // Header
    &__header {
        margin-bottom: $spacing-xl;

        h1 {
            margin-bottom: $spacing-sm;
            color: $text-primary;
        }

        .description {
            color: $text-secondary;
            font-size: 14px;
            margin: 0;
        }
    }

    // Content container
    &__content {
        background: $background-white;
        border: 1px solid $border-color;
        border-radius: $border-radius-md;
        padding: $spacing-lg;
        margin-top: $spacing-lg;
    }
}

// Settings sections
.settings-section {
    h2 {
        margin-bottom: $spacing-lg;
        padding-bottom: $spacing-md;
        border-bottom: 2px solid $border-color;
        color: $text-primary;
        font-size: 18px;
        font-weight: 600;
    }

    h3 {
        margin-top: $spacing-lg;
        margin-bottom: $spacing-md;
        color: $text-primary;
        font-size: 16px;
        font-weight: 600;
    }

    .description {
        color: $text-secondary;
        font-size: 13px;
        margin-top: $spacing-xs;
        line-height: 1.5;
    }

    // Spacing between form groups
    > * + * {
        margin-top: $spacing-lg;
    }
}

// API Key wrapper with show/hide button
.api-key-wrapper {
    display: flex;
    gap: $spacing-sm;
    align-items: center;

    input {
        flex: 1;
    }

    button {
        flex-shrink: 0;
    }
}

// API actions (test button + status)
.api-actions {
    display: flex;
    gap: $spacing-md;
    align-items: center;
    margin-top: $spacing-lg;
}

// Connection status indicator
.connection-status {
    display: flex;
    align-items: center;
    gap: $spacing-sm;
    font-size: 14px;

    .status-success {
        display: flex;
        align-items: center;
        gap: $spacing-xs;
        color: $success-color;
        font-weight: 500;
    }

    .status-error {
        display: flex;
        align-items: center;
        gap: $spacing-xs;
        color: $error-color;
        font-weight: 500;
    }

    .status-unknown {
        color: $text-secondary;
    }
}

// Cache statistics
.cache-stats {
    background: $background-light;
    border: 1px solid $border-color;
    border-radius: $border-radius-md;
    padding: $spacing-lg;
    margin: $spacing-lg 0;

    h3 {
        margin-top: 0;
        margin-bottom: $spacing-md;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: $spacing-md;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: $spacing-sm $spacing-md;
    background: $background-white;
    border: 1px solid $border-color;
    border-radius: $border-radius-sm;

    .stat-label {
        color: $text-secondary;
        font-size: 13px;
        font-weight: 500;
    }

    .stat-value {
        color: $text-primary;
        font-size: 16px;
        font-weight: 600;
    }
}

// Danger zone
.danger-zone {
    margin-top: $spacing-xl;
    padding: $spacing-lg;
    background: lighten($error-color, 45%);
    border: 1px solid lighten($error-color, 30%);
    border-radius: $border-radius-md;

    h3 {
        margin-top: 0;
        color: $error-color;
    }

    .description {
        color: darken($error-color, 10%);
        margin-bottom: $spacing-md;
    }
}

// Modal actions
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: $spacing-sm;
    margin-top: $spacing-lg;
    padding-top: $spacing-md;
    border-top: 1px solid $border-color;
}

// Loading state
.international-press-zone-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: $spacing-xl;
    min-height: 300px;

    p {
        margin-top: $spacing-md;
        color: $text-secondary;
    }
}

.international-press-zone-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid $border-color;
    border-top-color: $primary-color;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}



// Error state
.international-press-zone-error {
    padding: $spacing-xl;
    text-align: center;
    color: $error-color;

    .error-message {
        margin-top: $spacing-md;
        padding: $spacing-md;
        background: lighten($error-color, 45%);
        border: 1px solid lighten($error-color, 30%);
        border-radius: $border-radius-md;
        color: darken($error-color, 10%);
        font-weight: 500;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 782px) {
    .international-press-zone-settings {
        padding: $spacing-md;

        &__content {
            padding: $spacing-md;
        }
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .api-key-wrapper {
        flex-direction: column;
        align-items: stretch;

        button {
            width: 100%;
        }
    }

    .api-actions {
        flex-direction: column;
        align-items: stretch;

        button {
            width: 100%;
        }
    }

    .modal-actions {
        flex-direction: column;

        button {
            width: 100%;
        }
    }
}

.presszone-international-settings {
    &__form {
        display: block;
    }

    .international-data-region__skeleton {
        padding: 16px 0;
    }
}
