/* GIMA Ticket - Stylesheet */
/* Farben basierend auf gima-profi.de */

:root {
    --primary: #e64215;
    --primary-hover: #f36a45;
    --primary-dark: #d6491b;
    --dark: #1e1e1e;
    --gray-dark: #4f4f71;
    --gray: #5f7285;
    --gray-light: #dadae5;
    --gray-lighter: #e5e5e5;
    --bg: #f8f8fa;
    --bg-alt: #f5f5f8;
    --white: #ffffff;
    --surface: #ffffff;
    --text: #1e1e1e;
    --text-muted: #5f7285;
    --border: #e5e5e5;
    --shadow: rgba(0,0,0,0.08);
    --success: #2ecc71;
    --warning: #f1c40f;
    --info: #1e87f0;
    --danger: #e74c3c;
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-alt: #20203a;
    --surface: #222240;
    --text: #e0e0e8;
    --text-muted: #9090a8;
    --border: #3a3a58;
    --shadow: rgba(0,0,0,0.3);
    --gray: #8888a0;
    --gray-dark: #b0b0c8;
    --gray-light: #3a3a58;
    --gray-lighter: #32324e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

/* Navbar */
.navbar {
    background: #1e1e1e;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 2rem;
    position: relative;
    z-index: 100;
}

.nav-brand a {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.nav-brand a:hover {
    color: var(--primary);
}

.nav-logo {
    height: 32px;
    vertical-align: middle;
    background: #fff;
    padding: 2px 4px;
    border-radius: 4px;
    margin-right: 0.4rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo img {
    max-width: 180px;
    background: #fff;
    padding: 0.5rem;
    border-radius: 8px;
}

/* Desktop Navigation */
.nav-desktop {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    color: #dadae5;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-username {
    color: #dadae5;
    font-size: 0.9rem;
}

.nav-logout {
    color: var(--primary) !important;
}

/* Desktop Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    color: #dadae5;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}

.nav-dropdown-trigger:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-chevron {
    transition: transform 0.2s;
}

.nav-dropdown.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 30px var(--shadow);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}

.nav-dropdown-item:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-dropdown-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.nav-dropdown-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.nav-dropdown-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

/* Mobile Trigger (Hamburger) */
.nav-mobile-trigger {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #dadae5;
    cursor: pointer;
    padding: 0.4rem;
    transition: background 0.2s, border-color 0.2s;
    line-height: 0;
}

.nav-mobile-trigger:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

/* Mobile Sheet Overlay */
.nav-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-sheet-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Sheet / Drawer */
.nav-sheet {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--surface);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.2);
}

.nav-sheet.open {
    transform: translateX(0);
}

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

.nav-sheet-brand {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.nav-sheet-brand:hover {
    color: var(--primary);
}

.nav-sheet-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    line-height: 0;
}

.nav-sheet-close:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-sheet-link {
    display: block;
    padding: 0.65rem 0.75rem;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: background 0.15s;
}

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

/* Mobile Accordion */
.nav-sheet-accordion-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    border-radius: 6px;
    transition: background 0.15s;
}

.nav-sheet-accordion-trigger:hover {
    background: var(--bg);
}

.nav-sheet-accordion.open .nav-sheet-accordion-trigger .nav-chevron {
    transform: rotate(180deg);
}

.nav-sheet-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 0.5rem;
}

.nav-sheet-accordion.open .nav-sheet-accordion-content {
    max-height: 400px;
}

.nav-sheet-sublink {
    display: flex;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
    transition: background 0.15s;
}

.nav-sheet-sublink:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-sheet-divider {
    height: 1px;
    background: var(--border);
    margin: 0.75rem 0;
}

.nav-sheet-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-sheet-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    padding: .3rem .5rem;
    color: #dadae5;
    transition: color .15s, border-color .15s, background .15s;
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(230,66,21,.12);
}

/* Mobile theme toggle in sheet has different colors */
.nav-sheet .theme-toggle {
    color: var(--text-muted);
    border-color: var(--border);
}

.nav-sheet .theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Container */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-header h2 {
    font-size: 1.2rem;
    color: var(--text);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--bg-alt);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tbody tr:hover {
    background: var(--bg);
}

.ticket-link {
    font-weight: 600;
    color: var(--primary);
}

.ticket-number {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: monospace;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}

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

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

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--surface);
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 66, 21, 0.15);
}

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

select.form-control {
    appearance: auto;
}

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

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

.filters .form-group {
    margin-bottom: 0;
    min-width: 150px;
}

.filters .form-control {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
}

/* Ticket Detail */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.ticket-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.ticket-meta-item {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

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

.ticket-description {
    background: var(--bg);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    white-space: pre-wrap;
}

/* Comments */
.comment {
    padding: 1rem;
    border-left: 3px solid var(--border);
    margin-bottom: 1rem;
    background: var(--bg);
    border-radius: 0 4px 4px 0;
}

.comment.internal {
    border-left-color: var(--warning);
    background: rgba(241, 196, 15, 0.08);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

.comment-date {
    color: var(--text-muted);
}

.comment-body {
    white-space: pre-wrap;
}

/* KI-Kommentare */
.comment.ai-generated {
    border-left-color: var(--info);
    background: rgba(30, 135, 240, 0.08);
}

.ai-actions {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(30, 135, 240, 0.08);
    border: 1px solid var(--info);
    border-radius: 4px;
}

/* Login */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.login-box {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 1.8rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

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

.alert-error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.alert-info {
    background: rgba(30, 135, 240, 0.1);
    color: var(--info);
    border: 1px solid rgba(30, 135, 240, 0.3);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

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

/* Footer */
.site-footer {
    text-align: center;
    padding: 1.2rem 1rem;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary);
}

/* Legacy footer class */
.footer {
    text-align: center;
    padding: 1.2rem 1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: var(--surface);
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--primary);
}

/* Benutzer bearbeiten Grid */
.edit-user-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.edit-user-grid .card {
    margin-bottom: 0;
}

.edit-user-grid .card form {
    padding: 1rem 1.5rem 1.5rem;
}

.form-static {
    margin: 0;
    padding: 0.4rem 0;
    color: var(--text);
    font-weight: 500;
}

/* Agent Cards */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: border-color 0.2s;
}

.agent-card:hover {
    border-color: var(--primary);
}

.agent-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(230, 66, 21, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.agent-info h3 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.agent-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.agent-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.agent-status.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.agent-status.inactive {
    background: rgba(95, 114, 133, 0.15);
    color: var(--text-muted);
}

.agent-status.error {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
}

.agent-detail {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--bg);
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-right: 0.3rem;
}

/* KI Rules */
.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.rule-item .rule-text {
    flex: 1;
    font-size: 0.9rem;
}

.rule-item .rule-dept {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.rule-item .rule-actions {
    flex-shrink: 0;
}

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

.settings-grid .card {
    margin-bottom: 0;
}

.totp-secret {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--bg);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    text-align: center;
    word-break: break-all;
    color: var(--primary);
    border: 1px dashed var(--border);
}

/* Tabs */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-nav a {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.tab-nav a:hover {
    color: var(--text);
}

.tab-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Checkbox toggle */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-light);
    border-radius: 24px;
    transition: background 0.2s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

@media (max-width: 768px) {
    .edit-user-grid {
        grid-template-columns: 1fr;
    }

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

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        height: 56px;
        gap: 0;
    }

    .nav-desktop {
        display: none;
    }

    .nav-mobile-trigger {
        display: flex;
    }

    .container {
        padding: 1rem;
    }

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

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

    .filters {
        flex-direction: column;
    }

    .ticket-header {
        flex-direction: column;
    }

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