/**
 * Styles pour Stripe Subscription Manager
 */

/* === Container principal === */
.ssm-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.ssm-subscription-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* === En-têtes === */
.ssm-subscription-wrapper h2 {
    margin-top: 0;
    color: #1a1a1a;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

.ssm-subscription-wrapper h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* === Formulaire === */
.ssm-form-intro {
    margin-bottom: 25px;
    padding: 15px;
    background: #f7f9fc;
    border-left: 4px solid #635bff;
    border-radius: 4px;
}

.ssm-form-intro p {
    margin: 0;
    color: #555;
    line-height: 1.6;
}

.ssm-form-group {
    margin-bottom: 20px;
}

.ssm-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.ssm-form-group input[type="text"],
.ssm-form-group input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ssm-form-group input[type="text"]:focus,
.ssm-form-group input[type="email"]:focus {
    outline: none;
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

/* === Stripe Card Element === */
.ssm-card-element {
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    transition: border-color 0.2s;
}

.ssm-card-element.StripeElement--focus {
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.ssm-card-element.StripeElement--invalid {
    border-color: #fa755a;
}

#ssm-card-errors {
    color: #fa755a;
    font-size: 14px;
    margin-top: 8px;
    display: none;
}

/* === Checkbox === */
.ssm-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal !important;
}

.ssm-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
}

/* === Boutons === */
.ssm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.ssm-btn-primary {
    background: #4586cf;
    color: #ffffff;
    width: 100%;
}

.ssm-btn-primary:hover:not(:disabled) {
    background: #006db1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 91, 255, 0.3);
}

.ssm-btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.ssm-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.ssm-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.ssm-btn-link {
    color: #635bff;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.ssm-btn-link:hover {
    background: #f3f4f6;
}

/* === Loader === */
.ssm-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: ssm-spin 0.6s linear infinite;
    margin-right: 8px;
}

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

.ssm-loader {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

/* === Messages === */
.ssm-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.ssm-message.ssm-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.ssm-message.ssm-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* === Note de sécurité === */
.ssm-security-note {
    margin-top: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ssm-security-note svg {
    flex-shrink: 0;
    color: #9ca3af;
}

/* === Souscription active === */
.ssm-subscription-active {
    padding: 20px;
}

.ssm-status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.ssm-status-badge.ssm-status-active {
    background: #d1fae5;
    color: #065f46;
}

.ssm-status-badge.ssm-status-trialing {
    background: #dbeafe;
    color: #1e40af;
}

.ssm-status-badge.ssm-status-past_due,
.ssm-status-badge.ssm-status-unpaid {
    background: #fed7aa;
    color: #92400e;
}

.ssm-status-badge.ssm-status-canceled {
    background: #f3f4f6;
    color: #374151;
}

.ssm-subscription-info {
    background: #f9fafb;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
}

.ssm-subscription-info p {
    margin: 10px 0;
    color: #374151;
}

.ssm-subscription-info code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #1f2937;
}

/* === Transactions === */
.ssm-transactions-section {
    margin-top: 30px;
}

#ssm-transactions-container {
    margin-top: 20px;
}

.ssm-transactions-table {
    overflow-x: auto;
    margin-top: 15px;
}

.ssm-transactions-table table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.ssm-transactions-table th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 14px;
}

.ssm-transactions-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    font-size: 14px;
}

.ssm-transactions-table tr:last-child td {
    border-bottom: none;
}

.ssm-transactions-table tr:hover {
    background: #f9fafb;
}

.ssm-transactions-table code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #6b7280;
}

.ssm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ssm-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.ssm-badge-pending {
    background: #fed7aa;
    color: #92400e;
}

.ssm-no-transactions {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ssm-error {
    padding: 15px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    border: 1px solid #fca5a5;
}

/* === Responsive === */
@media (max-width: 768px) {
    .ssm-container {
        padding: 10px;
    }

    .ssm-subscription-wrapper {
        padding: 20px;
    }

    .ssm-transactions-table {
        font-size: 12px;
    }

    .ssm-transactions-table th,
    .ssm-transactions-table td {
        padding: 8px;
    }
    
    .ssm-form-row {
        flex-direction: column;
    }
    
    .ssm-header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* === Authentification === */
.ssm-auth-container {
    max-width: 500px;
    margin: 0 auto;
}

.ssm-auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 30px;
}

.ssm-auth-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.ssm-auth-tab:hover {
    color: #374151;
    background: #f9fafb;
}

.ssm-auth-tab.active {
    color: #635bff;
    border-bottom-color: #635bff;
}

.ssm-auth-form {
    display: none;
}

.ssm-auth-form.active {
    display: block;
}

.ssm-auth-intro {
    color: #6b7280;
    margin-bottom: 25px;
    font-size: 14px;
}

.ssm-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.ssm-form-row .ssm-form-group {
    flex: 1;
    margin-bottom: 0;
}

.ssm-field-hint {
    color: #6b7280;
    font-size: 13px;
    margin-top: 5px;
    margin-bottom: 0;
}

/* === Info Box === */
.ssm-info-box {
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.ssm-info-box h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

.ssm-info-box p {
    margin: 10px 0;
    color: #4b5563;
}

.ssm-info-box.ssm-warning {
    background: #fef3c7;
    border: 2px solid #fbbf24;
}

/* === Header avec actions === */
.ssm-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ssm-header-actions h2 {
    margin: 0;
}

.ssm-btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.ssm-user-info {
    background: #f0f9ff;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #3b82f6;
}

.ssm-user-info p {
    margin: 0;
    color: #1e40af;
    font-size: 14px;
}

/* === Messages dans les formulaires === */
.ssm-form .ssm-form-message {
    margin-top: 15px;
}

/* === Stripe Connect === */
.ssm-stripe-connected {
    text-align: center;
}

.ssm-stripe-connected h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #059669;
    margin-bottom: 30px;
}

.ssm-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #d1fae5;
    border-radius: 50%;
    font-size: 20px;
}

.ssm-connection-info {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.ssm-info-card {
    background: #ffffff;
    border-radius: 6px;
    padding: 20px;
}

.ssm-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.ssm-info-row:last-child {
    border-bottom: none;
}

.ssm-info-label {
    font-weight: 600;
    color: #374151;
}

.ssm-connection-status {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.ssm-status-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #065f46;
}

.ssm-status-message svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.ssm-status-message p {
    margin: 0;
    line-height: 1.6;
}

.ssm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.ssm-stripe-connect h2 {
    text-align: center;
    margin-bottom: 15px;
}

.ssm-connect-intro {
    text-align: center;
    color: #6b7280;
    margin-bottom: 40px;
    padding: 0 20px;
}

.ssm-connect-options {
    max-width: 600px;
    margin: 0 auto;
}

.ssm-connect-option {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
}

.ssm-option-express {
    border-color: #635bff;
    background: linear-gradient(135deg, #f9f5ff 0%, #f3f4f6 100%);
}

.ssm-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ssm-option-header h3 {
    margin: 0;
    font-size: 20px;
    color: #1a1a1a;
}

.ssm-badge-recommended {
    background: #635bff;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.ssm-features-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.ssm-features-list li {
    padding: 8px 0;
    color: #374151;
    font-size: 15px;
}

.ssm-btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
    justify-content: center;
}

.ssm-btn-stripe {
    background: #007ebb;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.ssm-btn-stripe:hover {
    background: #2366ae;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 91, 255, 0.3);
}

.ssm-help-section {
    max-width: 600px;
    margin: 40px auto 0;
    padding: 25px;
    background: #f9fafb;
    border-radius: 8px;
}

.ssm-help-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.ssm-help-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ssm-help-section li {
    padding: 8px 0;
    color: #374151;
}

.ssm-steps-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    counter-reset: step-counter;
}

.ssm-steps-list li {
    padding: 12px 0 12px 40px;
    position: relative;
    color: #374151;
}

.ssm-steps-list li::before {
    content: counter(step-counter);
    counter-increment: step-counter;
    position: absolute;
    left: 0;
    top: 8px;
    width: 28px;
    height: 28px;
    background: #635bff;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.ssm-info-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 15px 20px;
    margin: 20px 0;
}

.ssm-info-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1e40af;
}

.ssm-info-box p {
    margin: 0;
    color: #1e40af;
    line-height: 1.6;
}

/* === Badge de statut === */
.ssm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ssm-badge-success {
    background: #d1fae5;
    color: #065f46;
}


/* === Dashboard Stripe === */

/* === Formulaire de connexion amélioré === */
.ssm-intro-text {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 30px;
    line-height: 1.6;
}

.ssm-keys-section {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.2s;
}

.ssm-keys-section:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ssm-keys-test {
    border-left: 4px solid #fbbf24;
}

.ssm-keys-live {
    border-left: 4px solid #3b82f6;
}

.ssm-keys-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.ssm-keys-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.ssm-keys-header h4 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.ssm-keys-header p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.ssm-link-help {
    margin-left: auto;
    font-size: 14px;
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}

.ssm-link-help:hover {
    color: #1d4ed8;
}

.ssm-required {
    color: #dc2626;
    font-weight: 600;
}

.ssm-optional {
    color: #6b7280;
    font-weight: 400;
    font-size: 13px;
}

.ssm-key-input {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.ssm-input-with-toggle {
    position: relative;
}

.ssm-toggle-visibility {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #6b7280;
    transition: color 0.2s;
}

.ssm-toggle-visibility:hover {
    color: #111827;
}

.ssm-field-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #6b7280;
}

.ssm-hint-icon {
    font-size: 14px;
}

.ssm-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-top: 24px;
}

.ssm-info-box-blue {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.ssm-info-box svg {
    flex-shrink: 0;
    color: #2563eb;
}

.ssm-info-box strong {
    display: block;
    color: #1e40af;
    margin-bottom: 4px;
}

.ssm-info-box p {
    margin: 0;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.6;
}
