/* ===== Globales Layout ===== */
body {
    background-color: #f6f8fa;
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
}



.button-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 12px;       /* Abstand links/rechts */
  max-width: 100%;
  box-sizing: border-box;
}




.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.secrets-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(74, 144, 226, 0.15);
    color: #16437e;
}

.secrets-status.is-locked {
    background: #111;
    color: #fff;
}

.secrets-status.is-unlocked {
    background: #bbf7d0;
    color: #14532d;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #e7eef9;
    color: #16437e;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.toolbar-button:hover {
    background: #d0e1ff;
    border-color: #4A90E2;
    text-decoration: none;
}

.toolbar-button.active {
    background: #4A90E2;
    color: #fff;
    border-color: #4A90E2;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.25);
}

.toolbar-button.disabled {
    opacity: 0.55;
}

.toolbar-logout {
    background: #e53935;
    color: #fff;
}

.toolbar-logout:hover {
    background: #c62828;
    border-color: #c62828;
}

.inline-form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

/* Container / Panels */
.container, .mail-list, .mail-view, .sidebar {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 12px;
    margin-bottom: 15px;
}

/* ===== Sidebar ===== */
.sidebar {
    padding: 12px;
}

.sidebar a {
    display: block;
    padding: 6px 10px;
    margin: 3px 0;
    text-decoration: none;
    color: #333;
    border-radius: 6px;
    text-decoration: underline;
}

/* ===== Tabellen (Mail-Liste) ===== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

table thead tr {
    background: #4A90E2;
    color: #fff;
}

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

table tr:hover {
    background: #f5f9ff;
}

/* ===== Buttons ===== */
button, .btn, input[type=submit] {
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none; /* keine Unterstreichung */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
}

button:hover, .btn:hover, input[type=submit]:hover {
    background: #4A90E2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transform: translateY(-1px);
    text-decoration: none; /* auch beim Hover keine Unterstreichung */
}

button:disabled, .btn:disabled, input[type=submit]:disabled {
    background: #111;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.85;
    box-shadow: none;
    transform: none;
}

button:disabled:hover, .btn:disabled:hover, input[type=submit]:disabled:hover {
    background: #111;
    box-shadow: none;
    transform: none;
}

/* Sekundär-Button (z. B. "verschieben") */
.btn-secondary {
    background: #50E3C2;
}

.btn-secondary:hover {
    background: #3CBFA3;
}

.btn-reply {
    background: rgb(80, 217, 80);
}

.btn-reply:hover {
    background: rgb(68, 190, 68);
}

.btn-reply:disabled {
    background: #111;
}

.lock-hint {
    margin-top: 8px;
    font-size: 13px;
    color: #f97316;
}

/* Danger (rot) */
.btn-danger, button.btn-danger {
    background: #e53935;
}

.btn-danger:hover, button.btn-danger:hover {
    background: #c62828;
}

/* ===== Formular-Elemente ===== */
textarea, input[type=text], select {
    border-radius: 6px;
    border: 1px solid #ccc;
    padding: 6px 10px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 5px rgba(74,144,226,0.3);
}

/* ===== Mail-Ansicht ===== */
.mail-view {
    padding: 15px;
    line-height: 1.5;
}

.mail-view h2 {
    margin-top: 0;
    font-size: 16px;
    color: black;
}

/* AI-Reply Box */
.ai-reply {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    background: #fafbfc;
}

/* ===== Mail / AI Split ===== */
.mail-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.mail-layout .mail-content {
    flex: 3;
    min-width: 0;
}

.mail-layout .ai-panel {
    flex: 1;
    min-width: 240px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mail-layout .ai-section {
    border: 1px solid #e1e4e8;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
}

.mail-layout .ai-section h5 {
    margin-top: 0;
}

.ai-status {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 123, 255, 0.12);
    color: #0d2951;
}

.ai-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffd166;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.ai-status[data-state="ok"] {
    background: rgba(80, 217, 80, 0.18);
    color: #1b5e20;
}

.ai-status[data-state="ok"] .ai-status-dot {
    background: rgb(80, 217, 80);
}

.ai-status[data-state="error"] {
    background: rgba(229, 57, 53, 0.18);
    color: #b71c1c;
}

.ai-status[data-state="error"] .ai-status-dot {
    background: #e53935;
}

.ai-status[data-state="checking"] .ai-status-dot {
    background: #ffd166;
}

.mail-layout .ai-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 1100px) {
    .mail-layout {
        flex-direction: column;
    }

    .mail-layout .ai-panel {
        width: 100%;
        max-width: none;
    }
}

/* ===== 3-Spalten-Layout ===== */
/* Layout für die 3-Spalten-Ansicht */
.columns {
    display: flex;
    gap: 12px; /* Abstand zwischen den Spalten */
    padding: 10px;
    flex-wrap: wrap; /* erlaubt volle Breite Elemente */
    margin: 16px;
}

/* Jede Spalte soll wie eine "Blase" aussehen */
.column {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 12px;
    display: flex;
    flex-direction: column;
}

/* Volle Breite (3/3) z. B. Toolbar */
.column.full {
    flex: 0 0 100%;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.column.sidebar {
    flex: 0 0 210px;
    max-width: 240px;
}

.folder-link {
    display: block;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: #194a8d;
    background: transparent;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.folder-link:hover {
    background: #eef3fb;
    border-color: #c6d8f7;
    text-decoration: none;
}

.folder-link.active-folder {
    font-weight: 600;
    background: #dfe8fa;
    border-color: #9cb9f0;
    box-shadow: inset 0 0 0 1px rgba(25, 74, 141, 0.2);
}

.column.mail-list {
    flex: 1 1 380px;
    min-width: 260px;
    max-width: 520px;
}

.column.mail-view {
    flex: 1;
}

/* ===== Toolbar Button Wrapper ===== */
/* Wrapper-Blase für den Button */
.button-wrapper {
    display: flex;                      /* Toolbar füllt die Breite */
    justify-content: space-between;     /* Aktionen links, Logout rechts */
    align-items: center;
    gap: 20px;
    width: 100%;
    background: #fff;                   /* gleiche Blasenfarbe wie Spalten */
    border: 1px solid #e1e4e8;          /* gleiche Umrandung */
    border-radius: 10px;                /* gleiche Rundung */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 6px 10px;                  /* etwas Luft innen */
    margin-bottom: 12px;                /* Abstand nach unten */
}

/* Der Button selbst */
.button-wrapper button {
    background: #4A90E2;               /* Primärfarbe */
    border: none;                       /* keine extra Kante */
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;                           /* Abstand zwischen Icon und Text */
}

.button-group {
    display: flex;
    gap: 20px;
    align-items: center;
}

.button-wrapper form { margin: 0; }
.button-wrapper a { text-decoration: none; }

/* Anker, die wie Buttons gestylt sind */
a.btn { text-decoration: none; }

/* Hover-Effekt */
.button-wrapper:hover {
    border-color: #4A90E2;
    box-shadow: 0 2px 6px rgba(74,144,226,0.2);
}

.mail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mail-row input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}

.mail-row a {
    flex: 1;
    color: #194a8d;
    text-decoration: underline;
}

.mail-row-selected {
    background: #dfe8fa;
    border-color: #9cb9f0;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(25, 74, 141, 0.2);
}

/* Mail-Liste in der mittleren Spalte */
.mail-list {
    flex: 1;
    overflow-y: auto;
}

/* Mail-Ansicht in der rechten Spalte */
.mail-view {
    flex: 1;
    overflow-y: auto;
}

/* Scrollbars hübscher machen */
.mail-list::-webkit-scrollbar,
.mail-view::-webkit-scrollbar {
    width: 6px;
}
.mail-list::-webkit-scrollbar-thumb,
.mail-view::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
