/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', Arial, sans-serif;
}

body {
  background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem;
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  padding: 1rem 0;
}

/* Card container */
.card {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 600px;
  border-top: 4px solid #4CAF50;
  margin: 0 auto;
}

.card-body {
  padding: 1.5rem;
}

/* Logo */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.logo {
  width: 3rem;
  height: 3rem;
  background-color: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 500;
  color: #1f2937;
}

.header p {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab-btn:hover {
  color: #4CAF50;
}

.tab-btn.active {
  color: #4CAF50;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #4CAF50;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Status message */
.status-message {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  display: none;
}

.status-message i {
  margin-right: 0.75rem;
  font-size: 1.125rem;
}

.status-message.success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #dcfce7;
}

.status-message.success i {
  color: #22c55e;
}

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

.status-message.error i {
  color: #ef4444;
}

.status-message.loading {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
}

.status-message.loading i {
  color: #3b82f6;
}

/* Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-group label .required {
  color: #ef4444;
}

.input-container {
  position: relative;
}

.input-container i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
}

.form-control {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-control.error {
  border-color: #ef4444;
}

.error-text {
  display: none;
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
}

.error-text i {
  margin-right: 0.25rem;
}

.help-text {
  color: #6b7280;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Buttons */
.buttons-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn:focus {
  outline: none;
}

.btn i {
  margin-right: 0.5rem;
}

.btn-primary {
  background: linear-gradient(to right, #1E88E5, #2196F3);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 6px rgba(33, 150, 243, 0.2);
}

.btn-primary:focus {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(33, 150, 243, 0.5);
}

.btn-secondary {
  background: linear-gradient(to right, #E64A19, #FF5722);
  color: white;
}

.btn-secondary:hover {
  box-shadow: 0 4px 6px rgba(255, 87, 34, 0.2);
}

.btn-secondary:focus {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 87, 34, 0.5);
}

.btn-success {
  background: linear-gradient(to right, #2E7D32, #43A047);
  color: white;
}

.btn-success:hover {
  box-shadow: 0 4px 6px rgba(67, 160, 71, 0.2);
}

.btn-success:focus {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(67, 160, 71, 0.5);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem auto 0;
  padding: 0.5rem;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.875rem;
  cursor: pointer;
}

.clear-btn:hover {
  color: #374151;
}

.clear-btn i {
  margin-right: 0.25rem;
}

/* Info section */
.info-section {
  margin-top: 2rem;
  padding: 0.75rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.info-section h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.info-section h3 i {
  color: #4CAF50;
  margin-right: 0.5rem;
}

.info-list {
  font-size: 0.75rem;
  color: #6b7280;
  list-style: none;
}

.info-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.25rem;
}

.info-list li span {
  display: inline-block;
  width: 1rem;
  text-align: center;
  margin-right: 0.25rem;
}

/* Message Management */
.message-list {
  margin-bottom: 1.5rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.message-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.2s;
}

.message-item:last-child {
  border-bottom: none;
}

.message-item:hover {
  background-color: #f9fafb;
}

.message-item.active {
  background-color: #f0fdf4;
  border-left: 3px solid #4CAF50;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.message-name {
  font-weight: 500;
  color: #374151;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
}

.message-action-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.875rem;
}

.message-action-btn:hover {
  color: #4CAF50;
}

.message-preview {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.message-editor {
  margin-top: 1rem;
}

.message-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.message-editor-title {
  font-weight: 500;
  color: #374151;
}

.editor-toolbar {
  display: flex;
  padding: 0.5rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
}

.editor-button {
  background: none;
  border: none;
  color: #6b7280;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

.editor-button:hover {
  background-color: #f3f4f6;
  color: #4b5563;
}

.editor-button.active {
  background-color: #e5e7eb;
  color: #374151;
}

.editor-textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  resize: vertical;
  font-size: 0.875rem;
  line-height: 1.5;
}

.editor-textarea:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.message-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.emoji-picker {
  position: absolute;
  bottom: 100%;
  right: 0;
  z-index: 100;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
  max-width: 350px;
  max-height: 350px;
  overflow: hidden;
  display: none;
}

.emoji-picker.active {
  display: block;
}

.emoji-category-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
}

.emoji-category-tab {
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  background: none;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.emoji-category-tab:hover {
  background-color: #f5f5f5;
}

.emoji-category-tab.active {
  background-color: #f0f9f0;
  border-bottom: 2px solid #4CAF50;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  overflow-y: auto;
  max-height: 250px;
  padding: 0.25rem;
}

.emoji-category {
  display: none;
}

.emoji-category.active {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: transform 0.1s, background-color 0.2s;
}

.emoji-btn:hover {
  background-color: #f0f9f0;
  transform: scale(1.2);
  z-index: 1;
}

.emoji-search-container {
  padding: 0.5rem 0;
  position: relative;
}

.emoji-search {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  padding-left: 2rem;
}

.emoji-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
}

/* Spinner animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* New Message Form */
.new-message-form {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.form-title {
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
}

.form-title i {
  margin-right: 0.5rem;
  color: #4CAF50;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Modal */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  display: none;
}

.modal-container.active {
  display: flex;
}

.modal {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-title {
  font-weight: 500;
  color: #374151;
}

.modal-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 1.125rem;
}

.modal-close:hover {
  color: #ef4444;
}

.modal-body {
  padding: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

/* Confirmation dialog */
.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 400px;
  z-index: 60;
  display: none;
}

.confirm-dialog.active {
  display: block;
}

.confirm-dialog-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.confirm-dialog-title {
  font-weight: 500;
  color: #374151;
  display: flex;
  align-items: center;
}

.confirm-dialog-title i {
  margin-right: 0.5rem;
  color: #ef4444;
}

.confirm-dialog-body {
  padding: 1rem;
}

.confirm-dialog-message {
  color: #6b7280;
}

.confirm-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
}

.confirm-dialog-cancel {
  padding: 0.5rem 1rem;
  background-color: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
}

.confirm-dialog-confirm {
  padding: 0.5rem 1rem;
  background-color: #ef4444;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
}

.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 55;
  display: none;
}

.confirm-dialog-overlay.active {
  display: block;
}
/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: fadeIn 0.3s;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
}

.modal:not([style*="display: none"]) {
  display: block;
}

.modal-content {
  background-color: #fff;
  padding: 0;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  position: relative;
}

.modal-header {
  background-color: #f7f7f7;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #333;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.close-modal {
  color: #aaa;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #555;
}

.modal-message-list {
  margin-top: 10px;
}

.modal-message-item {
  padding: 12px 15px;
  border: 1px solid #eee;
  border-radius: 5px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-message-item:hover {
  background-color: #f5f9ff;
  border-color: #dce7ff;
}

.modal-message-name {
  font-weight: 600;
  margin-bottom: 5px;
  color: #333;
}

.modal-message-preview {
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-message {
  text-align: center;
  padding: 20px;
  color: #666;
  font-size: 0.9rem;
  background-color: #f9f9f9;
  border-radius: 5px;
  margin-top: 10px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* History Filter Styles */
.history-filter-container {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

/* History Table Styles */
.history-table-container {
  margin-top: 15px;
  overflow-x: auto;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.history-table th {
  background-color: #f7f7f7;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
}

.history-table tbody tr {
  transition: background-color 0.2s;
}

.history-table tbody tr:hover {
  background-color: #f5f5f5;
}

.history-table td:nth-child(5) { /* Message column */
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-table td:nth-child(4) { /* Type column */
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-text {
  font-size: 0.9rem;
  color: #666;
  margin: 15px 0 0;
  padding: 0;
}

/* Footer Styles */
.app-footer {
  text-align: center;
  margin-top: 20px;
  padding: 10px;
  color: #777;
  font-size: 0.8rem;
  border-top: 1px solid #eee;
  width: 100%;
  display: block;
  clear: both;
  position: relative;
  background-color: #f7f7f7;
}

/* Button Tertiary Style */
.btn-tertiary {
  background: linear-gradient(to right, #4a6da7, #5a7db7);
  color: white;
}

.btn-tertiary:hover {
  box-shadow: 0 4px 6px rgba(74, 109, 167, 0.2);
}

.btn-tertiary:focus {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(74, 109, 167, 0.5);
}

/* Ajuste de botones */
.btn {
  width: 100%;
}
