/**
 * Kunden-Portal CSS
 * techneo.berlin Ticket-System
 */

/* ==================== VARIABLEN ==================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #334155;
    --text-muted: #64748b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #334155;
    background: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* ==================== HEADER ==================== */
.portal-header {
    background: white;
    color: #334155;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.portal-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.portal-logo i {
    font-size: 1.5rem;
}

.portal-nav {
    display: flex;
    gap: 0.5rem;
}

.portal-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: #334155;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.portal-nav a:hover {
    background: var(--light);
    color: var(--primary);
    text-decoration: none;
}

.portal-nav a.active {
    background: var(--primary);
    color: white;
}

.portal-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #64748b;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* ==================== MAIN ==================== */
.portal-main {
    flex: 1;
    padding: 2rem 1.5rem;
}

.portal-main.logged-in {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.portal-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ==================== FOOTER ==================== */
.portal-footer {
    background: var(--dark);
    color: var(--secondary);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

.portal-footer p {
    margin: 0;
    font-size: 0.875rem;
}

/* ==================== AUTH PAGES ==================== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 2rem;
}

.auth-card {
    background: white;
    color: #334155;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card-wide {
    max-width: 550px;
}

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

.auth-header i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: block;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.logo-bracket {
    color: #1e293b;
    font-weight: 700;
    position: relative;
    top: -2px;
}

.logo-tech {
    color: #94a3b8;
}

.logo-neo {
    color: var(--primary);
    font-weight: 700;
}

.auth-header p {
    color: #64748b;
    font-size: 0.9rem;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-links {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.auth-links a {
    color: var(--primary);
}

.auth-links .separator {
    margin: 0 0.5rem;
    color: var(--border);
}


.back-link {
    color: #64748b;
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    min-height: 48px;
    color: #334155;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

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

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

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

.input-icon {
    position: relative;
}

.input-icon > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

.input-icon input,
.input-icon select,
.input-icon textarea {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    min-height: 48px;
    color: #334155;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon input:focus,
.input-icon select:focus,
.input-icon textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Password Toggle & Email Indicator */
.input-icon.has-toggle input,
.input-icon.has-indicator input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--primary);
}

/* ==================== EMAIL INDICATOR & BUBBLE ==================== */
.email-indicator {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.email-indicator.loading {
    color: var(--secondary);
}

.email-indicator.ok {
    color: var(--success);
}

.email-indicator.warning {
    color: #f59e0b;
}

.email-indicator.error {
    color: var(--danger);
}

.email-indicator:hover {
    transform: translateY(-50%) scale(1.1);
}

.email-bubble {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    color: #334155;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 100;
    animation: bubbleFadeIn 0.2s ease;
}

.email-bubble p {
    color: #334155;
    margin: 0.5rem 0 0.75rem;
}

@keyframes bubbleFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.bubble-arrow {
    position: absolute;
    top: -6px;
    right: 1rem;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.bubble-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.bubble-header.ok { color: var(--success); }
.bubble-header.warning { color: #b45309; }
.bubble-header.error { color: var(--danger); }

.bubble-content p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.bubble-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.bubble-btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #334155;
}

.checkbox-label input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-label span {
    line-height: 22px;
    position: relative;
    top: 2px;
}

/* ==================== HONEYPOT ==================== */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ==================== PASSWORD VALIDATION ==================== */
.password-requirements {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.password-requirements .requirement {
    font-size: 0.8rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-requirements .requirement i {
    font-size: 0.6rem;
    color: #64748b;
}

.password-requirements .requirement.fulfilled {
    color: var(--success);
}

.password-requirements .requirement.fulfilled i {
    color: var(--success);
    font-size: 0.85rem;
}

.password-strength {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.strength-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.3s, background-color 0.3s;
    background: var(--border);
}

.strength-fill.weak {
    background: var(--danger);
}

.strength-fill.medium {
    background: var(--warning);
}

.strength-fill.good {
    background: #84cc16;
}

.strength-fill.strong {
    background: var(--success);
}

.strength-text {
    font-size: 0.8rem;
    color: #64748b;
    min-width: 100px;
}

.password-match {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-match i {
    font-size: 0.6rem;
    color: var(--border);
}

.password-match.match {
    color: var(--success);
}

.password-match.match i {
    color: var(--success);
    font-size: 0.85rem;
}

.password-match.no-match {
    color: var(--danger);
}

.password-match.no-match i {
    color: var(--danger);
    font-size: 0.85rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: #334155;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==================== ALERTS (Toast-Style) ==================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.alert {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out forwards;
}

.alert.fade-out {
    animation: slideOutRight 0.3s ease-in forwards;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-left: 3px solid var(--success);
}

.alert-error,
.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 3px solid var(--primary);
}

.alert i {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.alert-success i { color: var(--success); }
.alert-error i, .alert-danger i { color: var(--danger); }
.alert-warning i { color: var(--warning); }
.alert-info i { color: var(--primary); }

/* Mobile: Alert unten anzeigen */
@media (max-width: 480px) {
    .alert {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ==================== CARDS ==================== */
.portal-card {
    background: white;
    color: #334155;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.portal-card h3 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-card h3 i {
    color: var(--primary);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 i {
    color: var(--primary);
}

.page-header .back-link {
    color: var(--secondary);
    margin-right: 0.5rem;
}

.page-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    color: #334155;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.stat-open {
    background: #dcfce7;
}
.stat-open .stat-value { color: #166534; }
.stat-open .stat-label { color: #166534; }

.stat-progress {
    background: #dbeafe;
}
.stat-progress .stat-value { color: #1e40af; }
.stat-progress .stat-label { color: #1e40af; }

.stat-closed {
    background: #f1f5f9;
}
.stat-closed .stat-value { color: #475569; }
.stat-closed .stat-label { color: #475569; }

/* ==================== FILTER BAR ==================== */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #334155;
    background: white;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--light);
    text-decoration: none;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==================== TICKET LIST ==================== */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: #334155;
    transition: all 0.2s;
    gap: 1rem;
}

.ticket-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

.ticket-main {
    flex: 1;
    min-width: 0;
}

.ticket-number {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.ticket-subject {
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-category {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 0.5rem;
}

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

.ticket-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ticket-priority.high {
    color: var(--danger);
    font-weight: 600;
}

.ticket-date {
    color: #64748b;
    font-size: 0.8rem;
}

.ticket-new-reply {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 4rem;
    color: var(--border);
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.empty-state p {
    color: #64748b;
    margin-bottom: 1.5rem;
}

/* ==================== TICKET DETAIL ==================== */
.ticket-status-badge {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.ticket-info-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.ticket-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.meta-item {
    padding: 0.75rem;
    background: var(--light);
    border-radius: 6px;
}

.meta-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-weight: 600;
    color: #334155;
}

.priority-high {
    color: var(--danger);
}

/* ==================== MESSAGES ==================== */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 1rem;
    border-radius: var(--radius);
}

.message-customer {
    background: #dbeafe;
    border-left: 4px solid var(--primary);
    margin-left: 2rem;
}

.message-staff {
    background: #f1f5f9;
    border-left: 4px solid var(--secondary);
    margin-right: 2rem;
}

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

.message-sender {
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-time {
    font-size: 0.8rem;
    color: #64748b;
}

.message-content {
    color: #334155;
    white-space: pre-wrap;
}

/* ==================== ATTACHMENTS ==================== */
.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light);
    border-radius: var(--radius);
    color: #334155;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
}

.attachment-item:hover {
    background: #e2e8f0;
    text-decoration: none;
}

.attachment-item i {
    color: var(--primary);
}

.attachment-size {
    color: #64748b;
    font-size: 0.75rem;
}

/* ==================== CLOSED NOTICE ==================== */
.closed-notice {
    text-align: center;
    padding: 2rem;
    background: var(--light);
}

.closed-notice i {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.closed-notice p {
    margin-bottom: 1.5rem;
    color: #64748b;
}

/* ==================== PROFILE ==================== */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.account-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 0.75rem;
    background: var(--light);
    border-radius: 6px;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 600;
    color: #334155;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .portal-header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }

    .portal-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .portal-nav a span {
        display: none;
    }

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

    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-meta {
        flex-wrap: wrap;
        margin-top: 0.75rem;
    }

    .message-customer,
    .message-staff {
        margin: 0;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
