@use '../abstracts' as *;

/**
 * Global Settings Page Styles (Tabbed Layout)
 */

// Settings & Notifications tabs in the builder share the same card centering.
#gfm-tab-settings,
#gfm-tab-notifications {
    .gfm-card {
        max-width: 850px;
        margin-left: auto;
        margin-right: auto;
        padding: $space-lg $space-xl;
    }
}

// ==========================
// Settings Page Header
// ==========================
.gfm-settings-page {
    .gfm-settings-header {
        margin-bottom: $space-lg;

        h1 {
            font-size: 28px;
            font-weight: 800;
            margin: 0 0 4px 0;
            line-height: 1.25;
            padding: 2px 0 4px;
            letter-spacing: -0.02em;
            background: linear-gradient(135deg, $primary 0%, #7C3AED 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .gfm-page-subtitle {
            margin: 0;
            font-size: 14px;
            color: $text-muted;
            line-height: 1.5;
        }
    }
}

// ==========================
// Two-column Layout
// ==========================
.gfm-settings-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: $space-lg;
    align-items: start;

    @media (max-width: 880px) {
        grid-template-columns: 1fr;
    }
}

// ==========================
// Vertical Tab Navigation
// ==========================
.gfm-settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: $white;
    border: 1px solid $border;
    border-radius: $radius-lg;
    padding: 8px;
    position: sticky;
    top: 40px;
    box-shadow: $shadow-sm;

    @media (max-width: 880px) {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }
}

.gfm-settings-nav-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: $radius-md;
    text-decoration: none;
    color: $text-main;
    transition: $transition-base;
    border: 1px solid transparent;

    &:hover {
        background: $primary-light;
        color: $primary;
    }

    &.is-active {
        background: linear-gradient(135deg, rgba($primary, 0.08), rgba($primary, 0.02));
        border-color: rgba($primary, 0.18);
        color: $primary;

        .dashicons {
            color: $primary;
        }
    }

    .dashicons {
        font-size: 20px;
        width: 20px;
        height: 20px;
        margin-top: 2px;
        color: $text-muted;
        flex-shrink: 0;
    }

    .gfm-settings-nav-label {
        display: flex;
        flex-direction: column;
        gap: 2px;
        line-height: 1.3;

        strong {
            font-size: 14px;
            font-weight: 700;
        }

        small {
            font-size: 12px;
            color: $text-muted;
            font-weight: 400;
        }
    }

    &.is-active .gfm-settings-nav-label small {
        color: rgba($primary, 0.75);
    }
}

// ==========================
// Settings Content Cards
// ==========================
.gfm-settings-content {
    display: flex;
    flex-direction: column;
    gap: $space-lg;
    min-width: 0;

    .gfm-card {
        padding: $space-lg $space-xl;
    }
}

.gfm-settings-section {
    h2 {
        font-size: 18px;
        font-weight: 800;
        margin: 0 0 6px 0;
        color: $text-main;
        letter-spacing: -0.01em;
    }

    .gfm-section-desc {
        font-size: 13.5px;
        color: $text-muted;
        margin: 0 0 $space-md 0;
        line-height: 1.6;

        a {
            color: $primary;
            font-weight: 600;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }
    }
}

// ==========================
// Settings Form Table
// ==========================
.genform-settings-form {
    table.form-table {
        margin-top: 0;
    }

    .form-table th {
        padding: 18px 24px 18px 0;
        width: 220px;
        font-size: 13px;
        font-weight: 700;
        color: $text-main;
        vertical-align: top;
        line-height: 1.4;
        text-transform: none;
        letter-spacing: 0;
    }

    .form-table td {
        padding: 18px 0;

        input[type="text"],
        input[type="email"],
        input[type="url"],
        input[type="password"],
        textarea {
            width: 100%;
            max-width: 480px;
        }

        p.description {
            margin-top: 8px;
            font-size: 12.5px;
            color: $text-muted;
            line-height: 1.5;
            max-width: 480px;
        }
    }

    // ==========================
    // Color Picker Field
    // ==========================
    .gfm-color-field {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        padding: 6px;
        border: 1px solid $border;
        border-radius: $radius-md;
        background: $white;
        transition: $transition-base;

        &:focus-within {
            border-color: $primary;
            box-shadow: 0 0 0 3px rgba($primary, 0.12);
        }

        .gfm-color-value {
            font-size: 13px;
            color: $text-muted;
            font-family: ui-monospace, SFMono-Regular, monospace;
            padding-right: 8px;
            background: transparent;
        }
    }

    .gfm-color-picker {
        height: 36px;
        width: 56px;
        padding: 2px;
        border: 1px solid $border;
        border-radius: $radius-sm;
        cursor: pointer;
        background: $white;

        &::-webkit-color-swatch-wrapper {
            padding: 0;
        }

        &::-webkit-color-swatch {
            border: none;
            border-radius: 4px;
        }
    }

    // ==========================
    // Checkbox Inline Label
    // ==========================
    .gfm-checkbox-label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        font-weight: 500;
        color: $text-main;
        text-transform: none;
        letter-spacing: 0;
        cursor: pointer;
        margin: 0;

        input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin: 0;
            cursor: pointer;
            accent-color: $primary;
        }

        span {
            line-height: 1.4;
        }
    }

    // ==========================
    // Submit Button
    // ==========================
    .gfm-settings-submit,
    .submit {
        margin-top: $space-md;
        padding: 0;
        border: none;
    }

    .button-primary,
    .gfm-settings-submit {
        background: linear-gradient(135deg, $primary 0%, $primary-dark 100%) !important;
        border: none !important;
        padding: 12px 32px !important;
        height: auto !important;
        font-weight: 700 !important;
        font-size: 14px !important;
        border-radius: $radius-md !important;
        box-shadow: 0 8px 16px -4px rgba($primary, 0.3) !important;
        transition: $transition-bounce !important;
        text-shadow: none !important;
        color: $white !important;
        cursor: pointer;

        &:hover {
            transform: translateY(-1px) !important;
            box-shadow: 0 12px 20px -4px rgba($primary, 0.35) !important;
        }

        &:active {
            transform: scale(0.98) !important;
        }
    }
}

// ==========================
// Tools Tab Cards
// ==========================
.gfm-tools-card {
    h2 {
        font-size: 17px;
        font-weight: 700;
        margin: 0 0 6px 0;
        color: $text-main;
        display: flex;
        align-items: center;
        gap: 8px;

        .dashicons {
            color: $primary;
        }
    }

    p {
        font-size: 13.5px;
        color: $text-muted;
        margin: 0 0 $space-md 0;
        line-height: 1.55;
    }
}

.gfm-pro-settings-card {
    background: linear-gradient(135deg, rgba($primary, 0.04), rgba(124, 58, 237, 0.04));
    border-color: rgba($primary, 0.18);

    h2 .dashicons {
        color: $primary;
    }
}
