* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c5f2d;
    --primary-hover: #234a24;
    --secondary: #E7CDA8;
    --success: #28a745;
    --danger: #dc3545;
    --text: #2c2c2c;
    --text-light: #666;
    --border: #e1e4e8;
    --bg: #f6f8fa;
    --card-bg: #ffffff;
    --sidebar-width: 280px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg,
            var(--primary) 0%,
            #1e4a1f 100%);
    /* background: linear-gradient(180deg,
            rgb(179, 0, 0) 0%,
            rgb(120, 0, 0) 100%); */
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}

.sidebar-subtitle {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.nav-tab {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.tab-icon {
    font-size: 20px;
}

.tab-label {
    text-align: left;
    flex: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn {
    margin-bottom: 8px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

#loginBtn {
    justify-content: center;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.status-indicator {
    font-size: 12px;
    color: #ffc107;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    color: #28a745;
    animation: none;
}

.status-indicator.error {
    color: #dc3545;
    animation: none;
}

.status-text {
    font-size: 12px;
    opacity: 0.9;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.content-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.content-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 0;
}

.content-body {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 28px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    /* color: var(--text); */
    color: rgb(179, 0, 0);

    /* Neu: */
    display: flex;
    align-items: center;
    gap: 8px;
    /* Abstand zwischen Checkbox und Text */
}

.form-group small {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.form-group input[type="color"] {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary {
    /* background: var(--primary); */
    background: rgb(179, 0, 0);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    /* background: var(--primary-hover); */
    background: rgb(179, 130, 130);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: #d5bc96;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg);
}

/* Logout-Button im Sidebar-Footer in Weiß darstellen */
.sidebar-footer .btn-outline {
    color: #ffffff;
    /* Text weiß */
    border-color: rgba(255, 255, 255, 0.6);
    /* heller Rand */
}

/* Hover-Zustand auch weiß lassen */
.sidebar-footer .btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    /* leicht aufgehellter Hintergrund */
    color: #ffffff;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-light);
}

.btn-icon:hover {
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.friends-list {
    display: grid;
    gap: 12px;
}

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.friend-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(44, 95, 45, 0.1);
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.friend-code {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    margin-left: 8px;
}

.friend-details {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.friend-actions {
    display: flex;
    gap: 8px;
}

.friend-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
}

.color-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-left: 4px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 16px;
}

.links-list {
    display: grid;
    gap: 12px;
}

.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(44, 95, 45, 0.1);
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text);
}

.link-url {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.email-templates-list {
    display: grid;
    gap: 12px;
}

.email-template-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.email-template-item.active {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(44, 95, 45, 0.15);
}

.email-template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.email-template-header:hover {
    background: rgba(44, 95, 45, 0.05);
}

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

.accordion-icon {
    font-size: 12px;
    color: var(--text-light);
    transition: transform 0.3s;
    margin-left: 8px;
}

.email-template-content {
    padding: 0 20px 20px;
}

.email-template-preview {
    margin-top: 12px;
}

.email-template-preview iframe {
    background: white;
}

.contenteditable-email {
    outline: none;
    transition: border-color 0.3s;
}

.contenteditable-email:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.contenteditable-email:hover {
    border-color: #999;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.info-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.info-box p {
    margin-bottom: 8px;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box code {
    background: rgba(44, 95, 45, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--primary);
}

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 24px;
    }
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 300;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

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

.mobile-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s;
        z-index: 200;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .friend-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .friend-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .link-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .link-info {
        width: 100%;
    }

    .link-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .content-header {
        flex-direction: column;
        gap: 16px;
    }

    .content-body {
        padding: 20px;
    }

    .email-template-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .email-template-header>div {
        width: 100%;
        justify-content: flex-end;
    }
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

.notification.info {
    border-left: 4px solid #17a2b8;
}

.card-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card-preview-modal.active {
    display: flex;
}

.card-preview-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 900px;
    background: transparent;
}

.card-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
    z-index: 2001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.card-preview-close:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.card-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: transparent;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #1e4a1f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 2.5em;
    /* color: var(--primary); */
    color: rgb(179, 0, 0);
    margin-bottom: 5px;
}

.login-header p {
    /* color: var(--text-light); */
    color: rgb(179, 0, 0);
    font-size: 1.1em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-error {
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 6px;
    font-size: 0.9em;
    text-align: center;
}