/* ==========================================================================
   NorthDesk – style.css
   Design-System angelehnt an northnode.dev
   Fonts: Outfit (sans) + JetBrains Mono (mono)
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* 1. Variablen & Reset                                                       */
/* -------------------------------------------------------------------------- */

:root {
    --bg-dark: #0a0e14;
    --bg-card: #0d1117;
    --bg-elevated: #131920;
    --bg-input: #0d1117;
    --accent: #39d353;
    --accent-dim: #238636;
    --accent-cyan: #58a6ff;
    --accent-orange: #f0883e;
    --danger: #f85149;
    --warning: #d29922;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --border: #21262d;
    --border-hover: #30363d;
    --font-sans: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* -------------------------------------------------------------------------- */
/* 2. Login                                                                    */
/* -------------------------------------------------------------------------- */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(57, 211, 83, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(88, 166, 255, 0.05) 0%, transparent 40%);
    pointer-events: none;
}

.login-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-logo {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-logo span,
.logo-accent { color: var(--accent); }

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

/* -------------------------------------------------------------------------- */
/* 3. Forms                                                                    */
/* -------------------------------------------------------------------------- */

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

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-1px);
    color: var(--bg-dark);
}

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

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text);
}

.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.btn-danger:hover { background: rgba(248, 81, 73, 0.25); color: var(--danger); }

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

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
    width: 32px; height: 32px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-muted); cursor: pointer; transition: all var(--transition);
}

.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* -------------------------------------------------------------------------- */
/* 4. Alerts                                                                   */
/* -------------------------------------------------------------------------- */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.25);
    color: var(--danger);
}

.alert-success {
    background: rgba(57, 211, 83, 0.1);
    border: 1px solid rgba(57, 211, 83, 0.25);
    color: var(--accent);
}

.alert-info {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.25);
    color: var(--accent-cyan);
}

/* -------------------------------------------------------------------------- */
/* 5. App Layout                                                               */
/* -------------------------------------------------------------------------- */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    display: block;
}

.sidebar-logo .bracket { color: var(--accent); }
.sidebar-logo .desk { color: var(--accent); }

.sidebar-company {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-family: var(--font-mono);
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    list-style: none;
}

.sidebar-nav-label {
    padding: 0.75rem 1.25rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.sidebar-nav li.active a {
    color: var(--text);
    background: var(--bg-elevated);
    border-left-color: var(--accent);
}

.sidebar-nav li a .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    font-family: var(--font-mono);
}

.sidebar-logout:hover { color: var(--danger); }

/* --- Main Content --- */

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

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

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.content-header .tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* 6. Module Grid (Dashboard)                                                  */
/* -------------------------------------------------------------------------- */

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.module-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(57, 211, 83, 0.08);
    color: var(--text);
}

.module-card-icon {
    width: 44px;
    height: 44px;
    background: rgba(57, 211, 83, 0.08);
    border: 1px solid rgba(57, 211, 83, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.module-card-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.module-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* -------------------------------------------------------------------------- */
/* 7. Cards & Tables                                                           */
/* -------------------------------------------------------------------------- */

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

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.table-wrap { overflow-x: auto; }

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

table th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 0.7rem 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

/* -------------------------------------------------------------------------- */
/* 8. Badges & Tags                                                            */
/* -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-green { background: rgba(57, 211, 83, 0.12); color: var(--accent); border: 1px solid rgba(57, 211, 83, 0.25); }
.badge-blue { background: rgba(88, 166, 255, 0.12); color: var(--accent-cyan); border: 1px solid rgba(88, 166, 255, 0.25); }
.badge-orange { background: rgba(240, 136, 62, 0.12); color: var(--accent-orange); border: 1px solid rgba(240, 136, 62, 0.25); }
.badge-red { background: rgba(248, 81, 73, 0.12); color: var(--danger); border: 1px solid rgba(248, 81, 73, 0.25); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* -------------------------------------------------------------------------- */
/* 9. Empty State                                                              */
/* -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p { max-width: 400px; margin: 0 auto; }

/* -------------------------------------------------------------------------- */
/* 10. Ticket-spezifisch                                                       */
/* -------------------------------------------------------------------------- */

.ticket-list { display: flex; flex-direction: column; gap: 0.5rem; }

.ticket-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}

.ticket-row:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
    color: var(--text);
}

.ticket-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 50px;
}

.ticket-subject { flex: 1; font-size: 0.9rem; }
.ticket-meta { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }

/* Ticket detail */

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

.ticket-detail-header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.message {
    padding: 1rem;
    border-radius: var(--radius);
    max-width: 85%;
}

.message-customer {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    align-self: flex-start;
}

.message-staff {
    background: rgba(57, 211, 83, 0.06);
    border: 1px solid rgba(57, 211, 83, 0.15);
    align-self: flex-end;
}

.message-author {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.message-body {
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.6;
}

.message-time {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
}

/* Ticket reply form */

.reply-form {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.reply-form textarea {
    flex: 1;
    padding: 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.reply-form textarea:focus { outline: none; border-color: var(--accent); }

/* -------------------------------------------------------------------------- */
/* 11. Password entries                                                        */
/* -------------------------------------------------------------------------- */

.pw-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.pw-entry:hover { border-color: var(--border-hover); }

.pw-entry-icon {
    width: 36px; height: 36px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.pw-entry-info { flex: 1; min-width: 0; }
.pw-entry-title { font-size: 0.9rem; font-weight: 600; }
.pw-entry-user { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

.pw-hidden {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

.pw-visible {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* 12. Email module                                                            */
/* -------------------------------------------------------------------------- */

.mailbox-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all var(--transition);
}

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

.mailbox-address {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-cyan);
    margin-bottom: 0.5rem;
}

.mailbox-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quota-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* -------------------------------------------------------------------------- */
/* 13. Responsive                                                              */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.25s ease;
    }

    .sidebar.open { left: 0; }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 0.75rem 1rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .mobile-toggle {
        background: none;
        border: none;
        color: var(--text);
        font-size: 1.25rem;
        cursor: pointer;
    }

    .module-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99;
        display: none;
    }

    .sidebar-overlay.active { display: block; }
}

@media (min-width: 769px) {
    .mobile-header { display: none; }
}

/* -------------------------------------------------------------------------- */
/* 14. Utilities                                                               */
/* -------------------------------------------------------------------------- */

.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.8rem; }
.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; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
