/* APPM Project Management Tool - Premium Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0c0d0f;
    --bg-card: rgba(24, 24, 27, 0.7);
    --bg-card-hover: rgba(30, 30, 35, 0.85);
    --bg-input: #1a1a1e;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(230, 0, 0, 0.4);
    
    --brand-red: #e60000;
    --brand-red-hover: #ff1a1a;
    --brand-red-glow: rgba(230, 0, 0, 0.25);
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Statusfarben */
    --status-pending: #71717a;
    --status-progress: #f59e0b;
    --status-completed: #10b981;
    --status-delayed: #ef4444;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--brand-red);
}

/* App Containers */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: rgba(12, 13, 15, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-circle {
    width: 2.2rem;
    height: 2.2rem;
    background-color: var(--brand-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: #fff;
    box-shadow: 0 0 12px var(--brand-red-glow);
}

.logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--brand-red);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-email {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background-color: var(--brand-red);
    color: #fff;
    box-shadow: 0 4px 12px var(--brand-red-glow);
}

.btn-primary:hover {
    background-color: var(--brand-red-hover);
    box-shadow: 0 6px 16px rgba(230, 0, 0, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #27272a;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #3f3f46;
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

.btn:active {
    transform: translateY(1px);
}

/* Main Content Area */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Grid & Layout System */
.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-title {
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: -0.5px;
}

.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
}

.filter-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--brand-red);
}

/* Auth View */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    padding: 1.5rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-red), #ff6b6b);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.15);
}

.auth-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 2FA OTP Code Container */
.otp-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.otp-box {
    width: 2.8rem;
    height: 3.2rem;
    font-size: 1.5rem;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    outline: none;
    transition: all 0.2s;
}

.otp-box:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 8px var(--brand-red-glow);
}

.otp-instruction-code {
    background: #27272a;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--brand-red-hover);
    text-align: center;
    margin: 1rem 0;
    letter-spacing: 4px;
    border: 1px dashed var(--border-color);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-id {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #27272a;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
}

.status-vorbereitung { background: rgba(113, 113, 122, 0.15); color: var(--text-secondary); }
.status-planung { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-durchfuehrung { background: rgba(14, 165, 233, 0.15); color: #38bdf8; }
.status-betrieb { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-storniert { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.project-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.project-meta-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.meta-item i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.progress-section {
    margin-top: auto;
}

.progress-bar-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}

.progress-pct {
    font-weight: 700;
}

.progress-bar-outer {
    height: 6px;
    background: #27272a;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background-color: var(--brand-red);
    border-radius: 10px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 6px var(--brand-red-glow);
}

/* Detail View Layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 992px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
}

.detail-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.detail-subtitle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.info-block h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-size: 0.85rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
}

.info-lbl {
    color: var(--text-secondary);
}

.info-val {
    font-weight: 600;
    text-align: right;
}

/* Form Wizard (New Project) */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Waterfall Timeline */
.timeline {
    position: relative;
    padding-left: 2.5rem;
    margin: 1.5rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2.5rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-main);
    border: 3px solid var(--text-muted);
    transition: all 0.3s;
    z-index: 2;
}

/* Timeline colors based on phase status */
.timeline-item.status-abgeschlossen .timeline-marker {
    border-color: var(--status-completed);
    background-color: var(--status-completed);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.timeline-item.status-in-arbeit .timeline-marker {
    border-color: var(--status-progress);
    background-color: var(--bg-main);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.timeline-item.status-verzoegert .timeline-marker {
    border-color: var(--status-delayed);
    background-color: var(--status-delayed);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.timeline-item.status-ausstehend .timeline-marker {
    border-color: var(--status-pending);
    background-color: var(--bg-main);
}

/* Connecting lines color dynamically */
.timeline-item.status-abgeschlossen + .timeline-item::before {
    background: var(--status-completed);
}

.timeline-content-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.timeline-content-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-hover);
}

.phase-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.phase-title {
    font-size: 1rem;
    font-weight: 700;
}

.phase-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.phase-badge-ausstehend { background: rgba(113, 113, 122, 0.1); color: var(--text-secondary); }
.phase-badge-in-arbeit { background: rgba(245, 158, 11, 0.1); color: #fbbf24; }
.phase-badge-abgeschlossen { background: rgba(16, 185, 129, 0.1); color: #34d399; }
.phase-badge-verzoegert { background: rgba(239, 68, 68, 0.1); color: #f87171; }

.phase-dates {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.phase-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 0.5rem;
    font-style: italic;
}

/* Edit Modal / Expand Area */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlide 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* General Toast System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    background: #18181b;
    border-left: 4px solid var(--brand-red);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 280px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left-color: var(--status-completed);
}

.toast-error {
    border-left-color: var(--status-delayed);
}
