/* AI Message Generator Plugin Styles */
.amg-widget {
    background: #e6f0fb;
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 100%;
    border: 1px solid #e1e8ed;
    position: relative;
    overflow: hidden;
}

.amg-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.amg-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.amg-header h3 {
    color: #1e3a5f;
    font-size: 1.4em;
    margin: 0 0 5px 0;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.amg-header p {
    color: #666;
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.amg-page-url {
    margin-top: 8px;
    font-size: 0.78em;
    word-break: break-all;
}

.amg-page-url a {
    color: #1976d2;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.amg-page-url a:hover {
    opacity: 1;
    text-decoration: underline;
}

.amg-form {
    position: relative;
    z-index: 1;
}

.amg-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.amg-form-group {
    display: flex;
    flex-direction: column;
}

.amg-form-group label {
    font-size: 0.85em;
    font-weight: 500;
    color: #444;
    margin-bottom: 5px;
}

.amg-form-group select,
.amg-form-group input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
    background: white;
    transition: all 0.2s ease;
}

.amg-form-group select:focus,
.amg-form-group input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 5px rgba(25, 118, 210, 0.2);
    transform: translateY(-1px);
}

.amg-form-group select:hover,
.amg-form-group input:hover {
    border-color: #42a5f5;
}

.amg-emoji-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
    position: relative;
    z-index: 1;
}

.amg-toggle-switch {
    position: relative;
    width: 45px;
    height: 24px;
}

.amg-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.amg-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.amg-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.amg-toggle-switch input:checked + .amg-slider {
    background-color: #1976d2;
}

.amg-toggle-switch input:checked + .amg-slider:before {
    transform: translateX(21px);
}

.amg-slider:hover {
    box-shadow: 0 0 10px rgba(25, 118, 210, 0.3);
}

.amg-generate-btn {
    width: 100%;
    background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.amg-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    background: linear-gradient(135deg, #1565c0 0%, #1e88e5 100%);
}

.amg-generate-btn:active {
    transform: translateY(0);
}

.amg-generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.amg-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: amg-spin 1s ease-in-out infinite;
}

@keyframes amg-spin {
    to { transform: rotate(360deg); }
}

.amg-results {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.amg-results::-webkit-scrollbar {
    width: 6px;
}

.amg-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.amg-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.amg-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.amg-message-item {
    background: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    border-left: 4px solid #1976d2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    transition: all 0.2s ease;
}

.amg-message-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.amg-message-text {
    font-size: 1em;
    line-height: 1.5;
    color: #333;
    margin: 0 0 10px 0;
    word-wrap: break-word;
    padding-right: 40px;
}

.amg-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f5f5f5;
    border: none;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    color: #666;
    transition: all 0.2s ease;
    min-width: 24px;
    text-align: center;
}

.amg-copy-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.amg-copy-btn.amg-copied {
    background: #4caf50;
    color: white;
}

.amg-api-status {
    font-size: 0.8em;
    color: #666;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 5px;
    position: relative;
    z-index: 1;
}

.amg-api-status.amg-success {
    background: #e8f5e8;
    color: #2e7d2e;
    border: 1px solid #c8e6c8;
}

.amg-api-status.amg-fallback {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.amg-api-status.amg-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.amg-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
    position: relative;
    z-index: 1;
}

.amg-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
    margin-top: 10px;
    border: 1px solid #ffcdd2;
    position: relative;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .amg-form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .amg-widget {
        padding: 15px;
        margin: 20px 0;
    }
    
    .amg-header h3 {
        font-size: 1.2em;
    }
    
    .amg-message-text {
        padding-right: 35px;
        font-size: 0.95em;
    }
    
    .amg-copy-btn {
        top: 8px;
        right: 8px;
        padding: 4px 6px;
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    .amg-widget {
        padding: 12px;
        margin: 15px 0;
        border-radius: 10px;
    }
    
    .amg-form-group {
        margin-bottom: 10px;
    }
    
    .amg-form-group select,
    .amg-form-group input {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .amg-generate-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .amg-message-item {
        padding: 12px;
        margin: 8px 0;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .amg-widget {
        background: linear-gradient(135deg, #1a237e 0%, #4a148c 100%);
        border-color: #424242;
    }
    
    .amg-header h3 {
        color: #90caf9;
    }
    
    .amg-header p {
        color: #b0bec5;
    }
    
    .amg-page-url a {
        color: #90caf9;
    }
    
    .amg-form-group label {
        color: #e0e0e0;
    }
    
    .amg-form-group select,
    .amg-form-group input {
        background: #424242;
        border-color: #616161;
        color: #e0e0e0;
    }
    
    .amg-form-group select:focus,
    .amg-form-group input:focus {
        border-color: #90caf9;
        box-shadow: 0 0 5px rgba(144, 202, 249, 0.3);
    }
    
    .amg-message-item {
        background: #424242;
        border-left-color: #90caf9;
    }
    
    .amg-message-text {
        color: #e0e0e0;
    }
    
    .amg-copy-btn {
        background: #616161;
        color: #e0e0e0;
    }
    
    .amg-copy-btn:hover {
        background: #757575;
    }
    
    .amg-emoji-toggle {
        color: #b0bec5;
    }
}

/* Print styles */
@media print {
    .amg-widget {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .amg-widget {
        background: white;
        border: 2px solid black;
    }
    
    .amg-generate-btn {
        background: black;
        color: white;
        border: 2px solid black;
    }
    
    .amg-message-item {
        border: 1px solid black;
        border-left: 4px solid black;
    }
}