/* Modern CRM Design System */
:root {
    --bg-primary: #0f0f11;
    --bg-secondary: #18181b;
    --bg-tertiary: #1f1f23;
    --bg-elevated: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #f87171;
    --border: #27272a;
    --border-light: #3f3f46;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 0;
}

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.buttons-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
}

.button:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.button svg {
    opacity: 0.7;
    transition: var(--transition);
}

.button:hover svg {
    opacity: 1;
}

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.button-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.button-ghost {
    background: transparent;
    border-color: var(--border-light);
}

.button-ghost:hover {
    background: var(--bg-tertiary);
}

.return-button {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.return-button:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Filter Section */
.leads-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder {
    color: var(--text-muted);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-button-wrapper {
    margin-left: auto;
}

/* Leads Section */
.leads-box-wrapper {
    margin-top: 8px;
}

.leads-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.leads-count p {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.count-label {
    color: var(--text-secondary);
}

#remainingLeads {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
    font-weight: 600;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    animation: pulse 2s infinite;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

/* Table */
.leads-table-wrapper {
    max-height: calc(100vh - 400px);
    min-height: 400px;
    overflow: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.leads-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 16px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
}

.leads-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.leads-table tbody tr {
    transition: var(--transition);
}

.leads-table tbody tr:hover {
    background: var(--bg-tertiary);
}

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

.leads-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.leads-table a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.leads-table select {
    min-width: 150px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.leads-table small {
    color: var(--text-muted);
    font-style: normal;
}

/* Set Date Button in Table */
.set-date-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-left: 8px;
    transition: var(--transition);
    color: var(--text-secondary);
}

.set-date-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 40px;
}

/* Custom Date Inputs */
#customDateInputs,
#customTerminDateInputs {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

#customDateInputs input[type="date"],
#customTerminDateInputs input[type="date"] {
    min-width: 150px;
}

/* Toast */
#datePickerToast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    min-width: 320px;
    max-width: 90%;
    opacity: 0;
    animation: toastFadeIn 0.25s ease forwards;
}

#datePickerToast h4 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
}

#datePickerToast input[type="date"],
#datePickerToast input[type="time"] {
    margin-bottom: 12px;
}

#datePickerToast button {
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

#toastSaveBtn {
    background: var(--accent);
    color: white;
}

#toastSaveBtn:hover {
    background: var(--accent-hover);
}

#toastCancelBtn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

#toastCancelBtn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Animations */
@keyframes toastFadeIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes toastFadeOut {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* User Header */
.user-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

#userImage {
    width: 200px;
    height: auto;
    object-fit: contain;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.25rem;
    }

    .buttons-container {
        gap: 8px;
    }

    .button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .button span {
        display: none;
    }

    .leads-filter {
        padding: 16px;
        gap: 12px;
    }

    .form-group {
        min-width: 100%;
    }

    .filter-button-wrapper {
        width: 100%;
        margin-left: 0;
    }

    .filter-button-wrapper .button {
        width: 100%;
        justify-content: center;
    }

    .leads-table-wrapper {
        max-height: calc(100vh - 500px);
    }
}

/* Status badge styles for potential future use */
.status-offen { color: var(--warning); }
.status-erreicht { color: var(--success); }
.status-negativ { color: var(--danger); }