/* =====================================================
   Time for Printess – Stylesheet
   Font: Ubuntu | Accent: #E10084
   ===================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --font-family: 'Ubuntu', sans-serif;
    --radius: 5px;
    --radius-lg: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* --- Light Theme (Default) --- */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --bg-card: #ffffff;
    --text-primary: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #737373;
    --text-light: #a3a3a3;
    --border: #e5e5e5;
    --border-focus: #E10084;
    --accent: #E10084;
    --accent-hover: #C10071;
    --accent-light: #FDF2F8;
    --accent-bg: #F8DFED;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --nav-bg: #ffffff;
    --nav-border: #e5e5e5;
    --input-bg: #ffffff;
    --hover-bg: #f5f5f5;
    --overlay: rgba(0,0,0,0.4);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-tertiary: #262626;
    --bg-card: #171717;
    --text-primary: #fafafa;
    --text-secondary: #d4d4d4;
    --text-muted: #a3a3a3;
    --text-light: #737373;
    --border: #404040;
    --border-focus: #E10084;
    --accent: #F06EBB;
    --accent-hover: #E1429F;
    --accent-light: #4E0630;
    --accent-bg: #4E0630;
    --success: #22c55e;
    --success-bg: #052e16;
    --error: #ef4444;
    --error-bg: #450a0a;
    --warning: #f59e0b;
    --warning-bg: #451a03;
    --nav-bg: #171717;
    --nav-border: #404040;
    --input-bg: #262626;
    --hover-bg: #262626;
    --overlay: rgba(0,0,0,0.7);
}

body {
    font-family: var(--font-family);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* --- Navigation --- */
.main-nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 2rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-logo img {
    height: 28px;
    width: auto;
}

[data-theme="light"] .logo-dark,
[data-theme="dark"] .logo-light {
    display: none;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.nav-user-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-user-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-user-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-logout {
    color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

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

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 500;
}

/* --- Page Headers --- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--error);
    color: #fff;
    border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.4rem;
    border-radius: var(--radius);
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
    color: var(--text-light);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* --- Avatar --- */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-initials {
    color: #fff;
    font-weight: 500;
    border-radius: 50%;
    text-align: center;
    letter-spacing: 0.5px;
}

/* --- Search / Autocomplete --- */
.search-wrapper {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-md);
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background var(--transition);
}

.search-result-item:hover,
.search-result-item.highlighted {
    background: var(--accent-light);
    color: var(--accent);
}

.search-result-item.create-new {
    border-top: 1px solid var(--border);
    color: var(--accent);
    font-weight: 500;
}

/* --- Chips / Tags (für Ansprechpartner) --- */
.chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.4rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 42px;
    align-items: center;
    cursor: text;
}

.chips-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 1.1rem;
    line-height: 1;
}

.chip-remove:hover {
    opacity: 1;
}

.chips-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 120px;
    padding: 0.2rem 0.35rem;
}

/* --- Timeline --- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-entry {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition);
}

.timeline-entry:hover {
    box-shadow: var(--shadow-md);
}

.timeline-entry-avatar {
    flex-shrink: 0;
    padding-top: 0.15rem;
}

.timeline-entry-body {
    flex: 1;
    min-width: 0;
}

.timeline-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.timeline-entry-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.timeline-entry-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.timeline-entry-customer {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
}

.timeline-entry-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.timeline-entry-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.timeline-entry-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.timeline-entry-description p {
    margin-bottom: 0.5rem;
}

.timeline-entry-description ul,
.timeline-entry-description ol {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.timeline-entry-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.contact-tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.timeline-entry-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* --- Filters --- */
.filters-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filters-bar .form-control {
    width: auto;
    min-width: 160px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Summary Box --- */
.summary-box {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--accent-light);
    border: 1px solid var(--accent-bg);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

/* --- Billing --- */
.billing-group {
    margin-bottom: 1.5rem;
}

.billing-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    gap: 1rem;
}

.billing-group-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.billing-group-total {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.billing-group-entries {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.billing-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.billing-entry:last-child {
    border-bottom: none;
}

.billing-entry-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    min-width: 80px;
}

.billing-entry-user {
    font-weight: 500;
    min-width: 100px;
}

.billing-entry-desc {
    flex: 1;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.billing-entry-duration {
    font-weight: 500;
    color: var(--accent);
    white-space: nowrap;
}

.billing-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.billing-check.billed {
    background: var(--success-bg);
    border-color: var(--success);
}

/* --- Checkbox --- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 2rem;
}

.login-container {
    display: flex;
    max-width: 900px;
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.login-image {
    flex: 1;
    background: linear-gradient(135deg, #FDF2F8 0%, #F7C7E3 50%, #F49FD1 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    min-height: 500px;
}

.login-image img {
    max-width: 200px;
    width: 80%;
    height: auto;
}

.login-image h2 {
    margin-top: 1.5rem;
    font-size: 1.3rem;
    font-weight: 500;
    color: #831857;
    text-align: center;
}

.login-form-area {
    flex: 1;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-area .nav-logo {
    margin-bottom: 2rem;
}

.login-form-area .nav-logo img {
    height: 36px;
}

.login-form-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-form-area p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-error {
    padding: 0.75rem;
    background: var(--error-bg);
    color: var(--error);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* --- Profile Page --- */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.profile-avatar-section {
    text-align: center;
    padding: 2rem;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    font-size: 2.5rem !important;
    margin-bottom: 1rem;
}

/* --- Admin Users Table --- */
.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.users-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover td {
    background: var(--hover-bg);
}

.role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-admin {
    background: var(--accent-bg);
    color: var(--accent);
}

.role-user {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* --- Quill Editor Anpassungen --- */
.quill-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.quill-wrapper .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.quill-wrapper .ql-container {
    border: none;
    font-family: var(--font-family);
    font-size: 0.9rem;
    min-height: 120px;
}

.quill-wrapper .ql-editor {
    color: var(--text-primary);
    min-height: 120px;
}

.quill-wrapper .ql-editor.ql-blank::before {
    color: var(--text-light);
    font-style: normal;
}

[data-theme="dark"] .ql-toolbar .ql-stroke {
    stroke: var(--text-muted);
}

[data-theme="dark"] .ql-toolbar .ql-fill {
    fill: var(--text-muted);
}

[data-theme="dark"] .ql-toolbar .ql-picker-label {
    color: var(--text-muted);
}

/* --- Alerts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state img {
    max-width: 120px;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* --- Utility --- */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }
    
    .nav-user-name {
        display: none;
    }
    
    .login-container {
        flex-direction: column;
    }
    
    .login-image {
        min-height: 200px;
        padding: 2rem;
    }
    
    .login-form-area {
        padding: 2rem 1.5rem;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 1.25rem 1rem;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-bar .form-control {
        width: 100%;
    }
    
    .timeline-entry {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .timeline-entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .billing-entry {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .nav-link span:not(.sr-only) {
        display: none;
    }
    
    .login-image {
        display: none;
    }
}
