:root {
    --color-tus-blue: #0033a0;
    --color-tus-blue-light: #335cbd;
    --color-tus-red: #e3000f;
    --color-tus-red-light: #eb333f;
    --color-bg: #f4f7fb;
    --color-surface: #ffffff;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    
    --color-yes: #10b981;
    --color-yes-bg: #d1fae5;
    --color-no: #ef4444;
    --color-no-bg: #fee2e2;
    --color-maybe: #f59e0b;
    --color-maybe-bg: #fef3c7;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Helper Classes */
.mt-10 { margin-top: 10px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.m-0 { margin: 0; }
.w-100 { width: 100%; }
.flex-row { display: flex; align-items: center; }
.gap-15 { gap: 15px; }
.gap-10 { gap: 10px; }
.gap-8 { gap: 8px; }
.inline-form { display: inline; margin: 0; }
.text-pre-line { white-space: pre-line; }
.text-light { color: var(--color-text-light); }
.break-all { word-break: break-all; }
.shrink-0 { flex-shrink: 0; }

.login-form-container { max-width: 400px; margin: 0 auto; }
.success-link { color: var(--color-tus-blue); font-weight: bold; text-decoration: none; }
.success-link:hover { text-decoration: underline; }
.btn-copy-sm { padding: 4px 8px; font-size: 0.8rem; margin-left: 10px; vertical-align: middle; }
.btn-copy { padding: 8px 14px; font-size: 0.9rem; }
.info-box { padding: 20px; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.poll-legend-box { margin-bottom: 20px; padding: 15px; background: var(--color-surface); border-radius: var(--radius-md); font-size: 0.9rem; display: flex; gap: 15px; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.poll-header-card { background: var(--color-surface); padding: 25px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border-left: 4px solid var(--color-tus-blue); }
.poll-title { margin-bottom: 10px; color: var(--color-tus-blue); font-size: 1.5rem; }
.poll-legend-card { background: #f8fafc; padding: 15px 20px; border-radius: var(--radius-md); border: 1px solid var(--color-border); display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.legend-label { font-weight: 600; color: var(--color-text-light); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.poll-legend-items { display: flex; gap: 15px; flex-wrap: wrap; font-size: 0.9rem; }
.legend-symbol { width: 28px; height: 28px; font-size: 0.9rem; pointer-events: none; }
.form-label { font-weight: 600; display: block; margin-bottom: 5px; }
.input-md { max-width: 300px; }
.table-container-md { max-width: 500px; }

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.app-header {
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    padding: 15px 0;
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 50px;
    object-fit: contain;
}

h1 {
    font-size: 1.5rem;
    color: var(--color-tus-blue);
    font-weight: 700;
}

.header-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 20px;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--color-text);
}

.hidden {
    display: none !important;
}

.view {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Buttons */
button, .btn {
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 16px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--color-tus-blue);
    color: white;
}
.btn-primary:hover { background-color: var(--color-tus-blue-light); transform: translateY(-1px); }

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid #d1d5db;
    text-decoration: none;
    display: inline-block;
}
.btn-secondary:hover { background-color: #f3f4f6; border-color: #9ca3af; }

.btn-danger {
    background-color: var(--color-tus-red);
    color: white;
}
.btn-danger:hover { background-color: var(--color-tus-red-light); transform: translateY(-1px); }

.btn-view {
    background-color: #e2e8f0;
    color: var(--color-tus-blue);
    text-decoration: none;
    display: inline-block;
}
.btn-view:hover { background-color: #cbd5e1; }

/* Polls Grid */
.polls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.poll-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--color-border);
}

.poll-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-tus-blue-light);
}

.poll-card h3 {
    color: var(--color-tus-blue);
    margin-bottom: 8px;
}

.poll-card p {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* Doodle Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 20px;
    margin-bottom: 30px;
}

.doodle-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.doodle-table th, .doodle-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
}

.doodle-table th:first-child, .doodle-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--color-surface);
    z-index: 2;
    box-shadow: 2px 0 5px rgba(0,0,0,0.03);
    font-weight: 600;
    min-width: 150px;
    max-width: 250px;
    overflow-wrap: anywhere;
}

.doodle-table thead th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--color-text);
    font-size: 0.9rem;
    white-space: normal;
    min-width: 120px;
    word-wrap: break-word;
}

.doodle-table thead th:first-child {
    z-index: 3;
}

.status-yes { background-color: var(--color-yes-bg); color: var(--color-yes); font-weight: bold; }
.status-no { background-color: var(--color-no-bg); color: var(--color-no); font-weight: bold; }
.status-maybe { background-color: var(--color-maybe-bg); color: var(--color-maybe); font-weight: bold; }

/* Voting Inputs */
.name-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.name-input:focus {
    border-color: var(--color-tus-blue);
}

.stats-row {
    background-color: #f8fafc;
    font-weight: 600;
    border-top: 2px solid var(--color-border);
}
.stats-yes {
    color: var(--color-yes);
}
.stats-maybe {
    color: var(--color-maybe);
    font-size: 0.85em;
    display: block;
    margin-top: 2px;
}

.vote-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    font-size: 1.1rem;
    padding: 0;
}

.vote-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.vote-btn.selected-yes { background: var(--color-yes); color: white; border-color: var(--color-yes); }
.vote-btn.selected-no { background: var(--color-no); color: white; border-color: var(--color-no); }
.vote-btn.selected-maybe { background: var(--color-maybe); color: white; border-color: var(--color-maybe); }

#poll-footer {
    background: #f8fafc;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: var(--color-surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 10px;
    color: var(--color-tus-blue);
}

.ticket-box {
    background: #f3f4f6;
    padding: 15px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    font-family: monospace;
    font-size: 1.1rem;
}

.ticket-box a {
    color: var(--color-tus-blue);
    font-size: 0.9rem;
    font-family: system-ui, -apple-system, sans-serif;
    word-break: break-all;
}

.modal-actions {
    margin-top: 20px;
}

@media (max-width: 768px) {
    .container { padding: 0 15px; }
    .doodle-table th:first-child, .doodle-table td:first-child {
        min-width: 120px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.9rem;
        padding-right: 5px;
    }
    .doodle-table th:not(:first-child) {
        min-width: 80px;
        max-width: 80px;
        white-space: normal;
        word-wrap: break-word;
        font-size: 0.8rem;
        line-height: 1.2;
    }
    .vote-btn { width: 40px; height: 40px; font-size: 1.1rem; }
}

@media (max-width: 600px) {
    .container { padding: 0 10px; }
    .app-header .container { gap: 10px; }
    .logo { height: 40px; }
    .app-header h1 { font-size: 1.2rem; }
    
    .doodle-table th:first-child, .doodle-table td:first-child {
        min-width: 90px;
        max-width: 90px;
        font-size: 0.85rem;
    }
    .doodle-table th, .doodle-table td { padding: 8px 4px; font-size: 0.85rem; }
    .doodle-table th:not(:first-child) {
        min-width: 65px;
        max-width: 65px;
        font-size: 0.75rem;
    }
    .vote-btn { width: 36px; height: 36px; font-size: 1rem; }
    .name-input, .form-control { font-size: 16px; /* Verhindert Auto-Zoom auf iPhones */ }
    .edit-actions { flex-direction: column; gap: 10px; }
    .edit-actions button { width: 100%; margin: 0; }
    .modal-content { padding: 20px; width: 95%; }
    #modal-ticket-link { font-size: 0.8rem; }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 0.9rem;
}
footer a {
    color: var(--color-tus-blue);
    text-decoration: none;
    margin: 0 5px;
}
footer a:hover {
    text-decoration: underline;
}
footer p {
    margin-bottom: 5px;
}
