/**
 * AI Therapy Notes - Styles
 * Clean, professional design that works with most themes
 */

/* Variables */
:root {
    --aitn-primary: #6366f1;
    --aitn-primary-hover: #4f46e5;
    --aitn-primary-light: #e0e7ff;
    --aitn-success: #10b981;
    --aitn-success-light: #d1fae5;
    --aitn-warning: #f59e0b;
    --aitn-warning-light: #fef3c7;
    --aitn-error: #ef4444;
    --aitn-error-light: #fee2e2;
    --aitn-text: #111827;
    --aitn-text-secondary: #6b7280;
    --aitn-text-muted: #9ca3af;
    --aitn-border: #e5e7eb;
    --aitn-bg: #ffffff;
    --aitn-bg-secondary: #f9fafb;
    --aitn-radius: 12px;
    --aitn-radius-sm: 8px;
    --aitn-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --aitn-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Container */
.aitn-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--aitn-text);
    line-height: 1.5;
}

/* Messages */
.aitn-message {
    padding: 24px 28px;
    border-radius: var(--aitn-radius);
    margin-bottom: 24px;
    text-align: center;
}

.aitn-message p {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.aitn-message-warning {
    background: var(--aitn-bg-secondary);
    border: 1px solid var(--aitn-border);
}

.aitn-message-subtext {
    margin-top: 16px !important;
    margin-bottom: 0 !important;
    font-size: 14px;
    color: var(--aitn-text-secondary);
}

.aitn-message-subtext a {
    color: var(--aitn-primary);
    text-decoration: none;
    font-weight: 500;
}

.aitn-message-subtext a:hover {
    text-decoration: underline;
}

/* Form */
.aitn-form {
    background: var(--aitn-bg);
    border: 1px solid var(--aitn-border);
    border-radius: var(--aitn-radius);
    padding: 28px;
    box-shadow: var(--aitn-shadow);
}

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

.aitn-form-group-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.aitn-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Labels */
.aitn-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--aitn-text);
    margin-bottom: 8px;
}

.aitn-form-group-inline .aitn-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.aitn-helper-text {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--aitn-text-muted);
}

/* Textarea */
.aitn-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--aitn-border);
    border-radius: var(--aitn-radius-sm);
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
    background: var(--aitn-bg);
    color: var(--aitn-text);
}

.aitn-textarea:focus {
    outline: none;
    border-color: var(--aitn-primary);
    box-shadow: 0 0 0 3px var(--aitn-primary-light);
}

.aitn-textarea::placeholder {
    color: var(--aitn-text-muted);
}

/* Select */
.aitn-select {
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--aitn-border);
    border-radius: var(--aitn-radius-sm);
    font-size: 14px;
    font-weight: 500;
    background: var(--aitn-bg);
    color: var(--aitn-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    min-width: 110px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.aitn-select:focus {
    outline: none;
    border-color: var(--aitn-primary);
    box-shadow: 0 0 0 3px var(--aitn-primary-light);
}

/* Buttons */
.aitn-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--aitn-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.aitn-btn-primary {
    background: var(--aitn-primary);
    color: #ffffff;
}

.aitn-btn-primary:hover {
    background: var(--aitn-primary-hover);
}

.aitn-btn-primary:disabled {
    background: var(--aitn-text-muted);
    cursor: not-allowed;
}

.aitn-btn-secondary {
    background: var(--aitn-bg);
    color: var(--aitn-text);
    border: 1px solid var(--aitn-border);
}

.aitn-btn-secondary:hover {
    background: var(--aitn-bg-secondary);
    border-color: var(--aitn-text-muted);
}

.aitn-btn svg {
    flex-shrink: 0;
}

/* Button loading state */
.aitn-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aitn-spinner {
    animation: aitn-spin 1s linear infinite;
}

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

/* Status */
.aitn-status {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: var(--aitn-radius-sm);
    font-size: 14px;
    display: none;
}

.aitn-status.aitn-status-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--aitn-primary-light);
    color: var(--aitn-primary-hover);
    border: 1px solid #c7d2fe;
}

.aitn-status.aitn-status-error {
    display: block;
    background: var(--aitn-error-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.aitn-status.aitn-status-success {
    display: block;
    background: var(--aitn-success-light);
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* Loading spinner in status */
.aitn-status-loading::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #c7d2fe;
    border-top-color: var(--aitn-primary);
    border-radius: 50%;
    animation: aitn-spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Output */
.aitn-output {
    margin-top: 24px;
    background: var(--aitn-bg);
    border: 1px solid var(--aitn-border);
    border-radius: var(--aitn-radius);
    overflow: hidden;
    box-shadow: var(--aitn-shadow);
}

.aitn-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--aitn-bg-secondary);
    border-bottom: 1px solid var(--aitn-border);
}

.aitn-output-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--aitn-text);
}

.aitn-result {
    padding: 24px;
    font-size: 15px;
    line-height: 1.8;
    color: var(--aitn-text);
    white-space: pre-wrap;
    font-family: inherit;
}

.aitn-result strong,
.aitn-result b {
    color: var(--aitn-primary-hover);
    font-weight: 600;
}

/* Footer */
.aitn-footer {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* Quota display */
.aitn-quota {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--aitn-text-secondary);
}

.aitn-quota-label {
    font-weight: 500;
}

.aitn-quota-divider {
    color: var(--aitn-text-muted);
}

.aitn-quota-pro {
    color: var(--aitn-success);
    font-weight: 500;
}

.aitn-quota-pro svg {
    stroke: var(--aitn-success);
}

.aitn-upgrade-link {
    color: var(--aitn-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s;
}

.aitn-upgrade-link:hover {
    color: var(--aitn-primary-hover);
    text-decoration: underline;
}

/* Privacy note */
.aitn-privacy-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--aitn-text-muted);
}

.aitn-privacy-note svg {
    stroke: var(--aitn-text-muted);
    flex-shrink: 0;
}

/* Copy success */
.aitn-btn-copied {
    background: var(--aitn-success) !important;
    border-color: var(--aitn-success) !important;
    color: #ffffff !important;
}

/* Responsive */
@media (max-width: 640px) {
    .aitn-wrap {
        padding: 16px;
    }
    
    .aitn-form {
        padding: 20px;
    }
    
    .aitn-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .aitn-form-group-inline {
        width: 100%;
        justify-content: space-between;
    }
    
    .aitn-btn {
        width: 100%;
    }
    
    .aitn-output-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .aitn-output-header .aitn-btn {
        width: 100%;
    }
    
    .aitn-quota {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
}

/* Dark mode support (if theme uses prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
    .aitn-wrap {
        /* Uncomment if you want dark mode support
        --aitn-text: #f3f4f6;
        --aitn-text-secondary: #9ca3af;
        --aitn-text-muted: #6b7280;
        --aitn-border: #374151;
        --aitn-bg: #1f2937;
        --aitn-bg-secondary: #111827;
        */
    }
}
