.htpasswd-gen-embed *,
.htpasswd-gen-embed *::before,
.htpasswd-gen-embed *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.htpasswd-gen-embed {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9f9;
}

/* Layout */
.htpasswd-gen-embed .container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.htpasswd-gen-embed .header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.htpasswd-gen-embed .title {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.htpasswd-gen-embed .description {
    color: #666;
    font-size: 0.95rem;
}


/* Main Content */
.htpasswd-gen-embed .main {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Form Styles */
.htpasswd-gen-embed .form-group {
    margin-bottom: 1.5rem;
}

.htpasswd-gen-embed .label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.htpasswd-gen-embed .input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.htpasswd-gen-embed .input:focus {
    outline: none;
    border-color: #7A9BB8;
    box-shadow: 0 0 0 3px rgba(122, 155, 184, 0.1);
}

.htpasswd-gen-embed .input.is-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.htpasswd-gen-embed .input.is-invalid:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.htpasswd-gen-embed .help-text {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* Password Input Group */
.htpasswd-gen-embed .password-input-group {
    position: relative;
}

.htpasswd-gen-embed .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem !important;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: #666;
    font-weight: 500;
}

.htpasswd-gen-embed .toggle-password:hover {
    background-color: #f0f0f0;
}

/* Password Generator Button - Subtle Design */
.htpasswd-gen-embed .generate-password-btn {
    width: 100%;
    padding: 0.4rem 0.8rem;
    background-color: transparent;
    color: #6c757d;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    font-size: 0.75rem !important;
    font-weight: 400 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.htpasswd-gen-embed .generate-password-btn:hover {
    background-color: #f8f9fa;
    border-color: #ced4da;
    opacity: 1;
}

.htpasswd-gen-embed .generate-password-btn:active {
    background-color: #e9ecef;
}

/* Password Strength Indicator */
.htpasswd-gen-embed .password-strength {
    margin-top: 0.5rem;
}

.htpasswd-gen-embed .strength-bar {
    width: 100%;
    height: 4px;
    background-color: #e1e8ed;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.htpasswd-gen-embed .strength-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.htpasswd-gen-embed .strength-fill.weak {
    width: 25%;
    background-color: #e74c3c;
}

.htpasswd-gen-embed .strength-fill.fair {
    width: 50%;
    background-color: #f39c12;
}

.htpasswd-gen-embed .strength-fill.good {
    width: 75%;
    background-color: #7A9BB8;
}

.htpasswd-gen-embed .strength-fill.strong {
    width: 100%;
    background-color: #7C9B7C;
}

.htpasswd-gen-embed .strength-text {
    font-size: 0.8rem;
    color: #666;
}

/* Encryption Info */
.htpasswd-gen-embed .encryption-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.htpasswd-gen-embed .encryption-method {
    font-weight: 600;
    color: #2c3e50;
}

.htpasswd-gen-embed .encryption-note {
    font-size: 0.85rem;
    color: #666;
}

/* Buttons */
.htpasswd-gen-embed .generate-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background-color: #939fc5;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.htpasswd-gen-embed .generate-btn:hover {
    background-color: #6A8AA8;
    transform: translateY(-1px);
}

.htpasswd-gen-embed .generate-btn:disabled {
    background-color: #A8B8C8;
    cursor: not-allowed;
    transform: none;
}

/* Result Section */
.htpasswd-gen-embed .result-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e1e8ed;
}

.htpasswd-gen-embed .result-title {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.htpasswd-gen-embed .result-output {
    position: relative;
    margin-bottom: 1rem;
}

.htpasswd-gen-embed .result-textarea {
    width: 100%;
    height: 100px;
    padding: 1rem;
    border: 2px solid #7C9B7C;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    resize: vertical;
    word-break: break-all;
}

.htpasswd-gen-embed .copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.5rem 1rem;
    background-color: #96b99f;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.htpasswd-gen-embed .copy-btn:hover {
    background-color: #229954;
}

.htpasswd-gen-embed .copy-btn.copied {
    background-color: #2ecc71;
}

.htpasswd-gen-embed .copy-btn-bottom {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #7C9B7C;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.htpasswd-gen-embed .copy-btn-bottom:hover {
    background-color: #6B8A6B;
    transform: translateY(-1px);
}

.htpasswd-gen-embed .copy-btn-bottom.copied {
    background-color: #8CAC8C;
}

.htpasswd-gen-embed .result-info {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* Messages */
.htpasswd-gen-embed .error-message {
    background-color: #ffe6e6;
    color: #c0392b;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e74c3c;
    margin-top: 1rem;
    outline: none;
}

.htpasswd-gen-embed .error-message:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.htpasswd-gen-embed .loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.htpasswd-gen-embed .loading span {
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

/* Footer */
.htpasswd-gen-embed .footer {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.htpasswd-gen-embed .encryption-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.htpasswd-gen-embed .encryption-section h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.htpasswd-gen-embed .encryption-section .encryption-info {
    padding: 0.5rem 0;
    background-color: transparent;
    border: none;
}

.htpasswd-gen-embed .encryption-section .encryption-method {
    font-size: 0.9rem;
}

.htpasswd-gen-embed .encryption-section .encryption-note {
    font-size: 0.8rem;
    color: #777;
}

.htpasswd-gen-embed .notice h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.htpasswd-gen-embed .notice ul {
    list-style-type: none;
    padding: 0;
}

.htpasswd-gen-embed .notice li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #ecf0f1;
    color: #666;
    font-size: 0.9rem;
}

.htpasswd-gen-embed .notice li:last-child {
    border-bottom: none;
}

.htpasswd-gen-embed .notice li:before {
    content: "•";
    margin-right: 0.5rem;
    font-weight: bold;
    color: #7A9BB8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .htpasswd-gen-embed .container {
        padding: 15px;
    }

    .htpasswd-gen-embed .main {
        padding: 1.5rem;
    }

    .htpasswd-gen-embed .title {
        font-size: 1.5rem;
    }

    .htpasswd-gen-embed .copy-btn {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
    }

    .htpasswd-gen-embed .copy-btn-bottom {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .htpasswd-gen-embed .result-output {
        display: flex;
        flex-direction: column;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .htpasswd-gen-embed * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Scoped form hardening to avoid theme interference --- */
.htpasswd-gen-embed input[type="text"],
.htpasswd-gen-embed input[type="password"],
.htpasswd-gen-embed textarea {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}
/* Ensure our component classes win via higher specificity */
.htpasswd-gen-embed .input.input { /* doubled class for specificity */ }
.htpasswd-gen-embed .generate-btn.generate-btn {}
.htpasswd-gen-embed .copy-btn.copy-btn {}
.htpasswd-gen-embed .copy-btn-bottom.copy-btn-bottom {}

/* ===== Fix: override SWELL/WP form styles that still bleed in ===== */
/* Inputs: enforce our box model, background, border, and spacing */
.htpasswd-gen-embed .input.input,
.htpasswd-gen-embed input.input[type="text"],
.htpasswd-gen-embed input.input[type="password"],
.htpasswd-gen-embed .password-input-group .input.input {
  background-color: #fff;
  border: 2px solid #e1e8ed;
  border-radius: 6px;
  box-shadow: none;            /* kill theme inner/outer shadow */
  min-height: auto;            /* kill theme min-height */
  height: auto;
  line-height: 1.4;
  padding: 0.75rem;            /* base padding */
  width: 100%;
  display: block;
}
/* add space for the eye-toggle button */
.htpasswd-gen-embed .password-input-group .input.input {
  padding-right: 3rem;         /* ensure text doesn't run under the toggle */
}
/* Focus state: our glow only */
.htpasswd-gen-embed .input.input:focus,
.htpasswd-gen-embed input.input[type="text"]:focus,
.htpasswd-gen-embed input.input[type="password"]:focus {
  outline: none;
  border-color: #7A9BB8;
  box-shadow: 0 0 0 3px rgba(122,155,184,.1);
  background-color: #fff;
}
/* Placeholder and help text color normalization */
.htpasswd-gen-embed .input.input::placeholder,
.htpasswd-gen-embed input.input::placeholder { color: #9aa3ab; opacity: 1; }

/* Buttons in the field area (toggle, generate) should not adopt theme button styles */
.htpasswd-gen-embed .toggle-password,
.htpasswd-gen-embed .generate-password-btn {
  font: inherit;
  box-shadow: none;
}

/* Fix: cancel unintended margin-left applied by theme */
.htpasswd-gen-embed .input.input,
.htpasswd-gen-embed input.input[type="password"] {
  margin-left: 0 !important;
}

/* Fix: neutralize theme styles on result-title */
.htpasswd-gen-embed .result-title {
  all: unset;
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 1rem;
}