@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Montserrat", sans-serif;
  background: #f9fafb;
  color: #111827;
}
header {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}
nav {
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2563eb;
}
.nav-links a {
  margin: 0 1rem;
  text-decoration: none;
  color: #374151;
  font-weight: 500;
}
.nav-links a:hover {
  color: #2563eb;
}

.hero {
  text-align: center;
  padding: 6rem 2rem;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}
.hero h1 {
  font-size: 3rem;
  color: #1e3a8a;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.2rem;
  color: #475569;
  margin-bottom: 2rem;
}

.btn-primary {
  background: #2563eb;
  color: white;
  padding: 0.8rem 1.6rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
  display: inline-block;
}
.btn-primary:hover {
  background: #1d4ed8;
}
.btn-primary.green {
  background: #10b981;
}
.btn-primary.green:hover {
  background: #059669;
}

.features {
  max-width: 1100px;
  margin: 5rem auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 0 2rem;
}
.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  text-align: center;
  transition: 0.3s;
}
.feature-card:hover {
  transform: translateY(-5px);
}
.feature-card h3 {
  color: #1e3a8a;
  margin-bottom: 1rem;
}

.cta {
  text-align: center;
  padding: 5rem 2rem;
  background: #1e3a8a;
  color: white;
}
.cta h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.cta p {
  margin-bottom: 2rem;
}
.cta input {
  padding: 0.8rem;
  width: 260px;
  border-radius: 6px;
  border: none;
  margin-right: 0.5rem;
}
.cta button {
  padding: 0.8rem 1.5rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.cta button:hover {
  background: #3b82f6;
}

footer {
  background: #111827;
  color: #9ca3af;
  text-align: center;
  padding: 2rem;
}
footer a {
  color: #9ca3af;
  text-decoration: none;
  margin: 0 0.5rem;
}
footer a:hover {
  color: white;
}

.auth-links {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Formularze logowania i rejestracji */
.form-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  background: #f5f6fa;
}

.auth-form {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-form h2 {
  color: #1e3a8a;
  margin-bottom: 1.5rem;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.auth-form button {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.auth-form button:hover {
  background: #1d4ed8;
}

.error {
  color: #dc2626;
  background: #fee2e2;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.success {
  color: #16a34a;
  background: #dcfce7;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.form-footer {
  margin-top: 1rem;
}

.form-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* formularze auth */
.form-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  background: #f5f6fa;
}
.auth-form {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-form h2 {
  color: #1e3a8a;
  margin-bottom: 1.5rem;
}
.auth-form input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}
.auth-form button {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}
.auth-form button:hover {
  background: #1d4ed8;
}
.error {
  color: #dc2626;
  background: #fee2e2;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.success {
  color: #16a34a;
  background: #dcfce7;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.form-footer {
  margin-top: 1rem;
}
.form-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}
.form-footer a:hover {
  text-decoration: underline;
}

/* PANEL ADMINA */
.admin-container {
  max-width: 1000px;
  margin: 60px auto;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.admin-container h2 {
  color: #1e3a8a;
  text-align: center;
  margin-bottom: 1.5rem;
}

.btn-back {
  display: inline-block;
  margin-bottom: 1rem;
  background: #2563eb;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
  margin-top: 20px;
}
.btn-back:hover {
  background: #1d4ed8;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 15px;
}

.user-table th {
  background: #2563eb;
  color: white;
}

.status.active {
  color: #16a34a;
  font-weight: 600;
}

.status.inactive {
  color: #dc2626;
  font-weight: 600;
}

.btn-activate {
  background: #10b981;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}
.btn-activate:hover {
  background: #059669;
}

.btn-disabled {
  background: #9ca3af;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
}

.success-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-delete {
  background: #dc2626;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
}

.btn-delete:hover {
  background: #b91c1c;
}

.actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.dashboard-container {
  max-width: 800px;
  margin: 60px auto;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.dashboard-header h2 {
  color: #1e3a8a;
  margin-bottom: 0.5rem;
}

.dashboard-header p {
  color: #475569;
  margin-bottom: 2rem;
}

.dashboard-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard-content h3 {
  color: #1e40af;
  margin-bottom: 0.5rem;
}

.ai-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.ai-form textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  resize: vertical;
}

.ai-form button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
}

.ai-form button:hover {
  background: #1d4ed8;
}

.ai-result {
  margin-top: 2rem;
  background: #f9fafb;
  border-radius: 12px;
  padding: 20px;
  text-align: left;
}

.ai-result h3 {
  color: #1e3a8a;
  margin-bottom: 10px;
}

.result-box {
  background: white;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e5e7eb;
  font-family: "Inter", sans-serif;
  white-space: pre-wrap;
}

/* === PANEL GŁÓWNY === */
.dashboard-container {
  max-width: 900px;
  margin: 60px auto;
  background: #ffffff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* === NAGŁÓWEK === */
.dashboard-header {
  text-align: center;
  margin-bottom: 35px;
}
.dashboard-header h2 {
  color: #1e3a8a;
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.dashboard-header p {
  color: #6b7280;
  font-size: 1rem;
}

/* === PRZYCISKI === */
.dashboard-buttons {
  text-align: center;
  margin-bottom: 25px;
}
.dashboard-buttons a,
.dashboard-buttons span {
  display: inline-block;
  margin: 6px 10px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.25s ease;
}

/* główny niebieski */
.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

/* szary, neutralny */
.btn-secondary {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #e5e7eb;
}
.btn-secondary:hover {
  background: #e5e7eb;
}

/* status połączenia */
.connected {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* === FORMULARZ AI === */
.ai-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.ai-form textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  resize: vertical;
  color: #111827;
  background: #f9fafb;
  transition: border-color 0.2s;
}
.ai-form textarea:focus {
  outline: none;
  border-color: #2563eb;
}
.ai-form button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}
.ai-form button:hover {
  background: #1d4ed8;
}

/* === WYNIK AI === */
.ai-result {
  margin-top: 35px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 25px;
  border: 1px solid #e5e7eb;
}
.ai-result h3 {
  color: #1e3a8a;
  font-size: 1.2rem;
  margin-bottom: 10px;
}
.result-box {
  background: white;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e5e7eb;
  line-height: 1.6;
  color: #111827;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

/* === RESPONSYWNOŚĆ === */
@media (max-width: 768px) {
  .dashboard-container {
    margin: 30px 15px;
    padding: 25px;
  }
  .ai-form textarea {
    min-height: 140px;
  }
}

/* === DASHBOARD === */
.dashboard-container {
  max-width: 1200px;
  margin: 50px auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 30px;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 25px;
}

.dashboard-header h2 {
  font-size: 26px;
  color: #222;
  margin-bottom: 5px;
}

.dashboard-header p {
  color: #666;
  font-size: 15px;
}

.dashboard-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #1e53ff;
  color: #fff;
}

.btn-primary:hover {
  background: #003ae6;
}

.btn-secondary {
  background: #f2f3f5;
  color: #333;
}

.btn-secondary:hover {
  background: #e2e3e6;
}

.connected {
  background: #d4f6df;
  color: #207a3b;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
}
/* === GMAIL DASHBOARD === */
.gmail-section {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #f9fafc;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-top: 30px;
  min-height: 500px;
}

/* === LISTA WIADOMOŚCI === */
.gmail-list {
  width: 35%;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  overflow-y: auto;
  max-height: 75vh;
  border: 1px solid #e5e7eb;
}

.email-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.email-item:hover {
  background: #eef4ff;
}

.email-item.active {
  background: #dbe7ff;
  border-radius: 6px;
}

.email-from {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 14px;
  margin-bottom: 3px;
}

.email-subject {
  color: #1e53ff;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-snippet {
  font-size: 12px;
  color: #666;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

/* === PANEL PODGLĄDU WIADOMOŚCI === */
.gmail-content {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  max-height: 75vh;
  overflow-y: auto;
  font-family: "Segoe UI", sans-serif;
}

.email-view {
  background: #fafbff;
  border: 1px solid #e3e4ea;
  border-radius: 6px;
  padding: 20px;
}

.email-view h3 {
  margin-top: 0;
  font-size: 18px;
  color: #1e53ff;
  word-break: break-word;
}

.email-from-detail {
  color: #444;
  font-size: 13px;
  margin-bottom: 12px;
}

.email-body {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 15px;
  margin-top: 10px;
  max-height: 350px;
  overflow-y: auto;
  line-height: 1.6;
  color: #333;
}

.email-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* === AI FORM === */
.ai-reply-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-reply-form textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 6px;
  border: 1px solid #ddd;
  padding: 10px;
  font-family: "Inter", sans-serif;
  resize: vertical;
}

.reply-actions {
  display: flex;
  gap: 10px;
}

.btn-generate,
.btn-send {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-generate:hover,
.btn-send:hover {
  background: #1e4fd1;
}

/* === DODATKOWE === */
.loading {
  text-align: center;
  color: #777;
  font-style: italic;
}

.error {
  color: #c0392b;
  text-align: center;
  margin: 20px 0;
}

/* === RESPONSYWNOŚĆ === */
@media (max-width: 900px) {
  .gmail-section {
    flex-direction: column;
  }
  .gmail-list {
    width: 100%;
    max-height: none;
  }
  .gmail-content {
    max-height: none;
  }
}

.back-note {
  text-align: center;
  margin-top: 40px;
  color: #999;
  font-size: 15px;
}

.back-note a {
  color: #888;
  text-decoration: none;
  font-weight: 500;
}

.back-note a:hover {
  color: #555;
  text-decoration: underline;
}

/* === DASHBOARD LAYOUT === */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: #f5f7fb;
}

/* === SIDEBAR === */
.sidebar {
    width: 240px;
    background: #1e40af;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}
.sidebar h2 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    color: #fff;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #e0e7ff;
    text-decoration: none;
    transition: background 0.2s;
}
.sidebar a:hover {
    background: #3749c0;
}
.sidebar a.active {
    background: #2563eb;
    color: #fff;
}
.sidebar .bottom {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 10px;
}

/* === MAIN AREA === */
.dashboard-main {
    flex: 1;
    padding: 30px;
}
.dashboard-header {
    margin-bottom: 20px;
}
.dashboard-header h2 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 5px;
}
.dashboard-header p {
    color: #475569;
}

/* === RESPONSYWNOŚĆ === */
@media (max-width: 900px) {
    .gmail-section {
        display: block;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
}


.personas-container {
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.personas-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.persona-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 15px;
    transition: 0.2s;
}
.persona-card.active {
    border-color: #2563eb;
    background: #f5f8ff;
}
.persona-avatar {
    font-size: 30px;
    margin-right: 15px;
}
.persona-info {
    flex: 1;
}
.signature-preview {
    margin-top: 10px;
    border-top: 1px dashed #ddd;
    padding-top: 8px;
    font-size: 14px;
    color: #444;
}
.persona-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}
.persona-add {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}
.persona-add form input,
.persona-add form textarea {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 8px;
}
.active-label {
    color: #2563eb;
    font-weight: 600;
}
.back-link {
    margin-top: 30px;
    text-align: center;
}
.back-link a {
    color: #2563eb;
    text-decoration: none;
}

.persona-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f3f4f6;
    flex-shrink: 0;
}

.persona-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.persona-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.persona-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.persona-info h3 {
    margin: 0;
    color: #1e3a8a;
}

.persona-info p {
    color: #444;
    margin-top: 4px;
    font-size: 14px;
}


/* === WYBÓR OSOBOWOŚCI W DASHBOARD === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.persona-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.persona-selector .persona-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.persona-selector .persona-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.persona-selector .persona-avatar.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.persona-selector .persona-avatar:hover {
    transform: scale(1.05);
}
/* === LAYOUT TONEO === */
.toneo-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f9fafb;
    font-family: "Inter", sans-serif;
}

.toneo-layout .sidebar {
    flex-shrink: 0;
    width: 250px;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
}

.toneo-content {
    flex: 1;
    margin-left: 250px; /* szerokość sidebar */
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.toneo-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.toneo-inner {
    min-height: 100%;
    padding: 40px;
    background: #f9fafb;
}

/* === RESPONSYWNOŚĆ === */
@media (max-width: 900px) {
    .toneo-layout .sidebar {
        width: 220px;
    }
    .toneo-content {
        margin-left: 220px;
    }
}

@media (max-width: 700px) {
    .toneo-layout {
        flex-direction: column;
    }
    .toneo-layout .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    .toneo-content {
        margin-left: 0;
        height: calc(100vh - 60px);
    }
}
