/**
 * HLP7 Helpdesk - Stylesheet
 * Design angelehnt an Payment-Portal (bemakedo.ch)
 * 
 * @version 1.0.0
 */

/* =============================================================================
   CSS VARIABLES
   ============================================================================= */
:root {
    /* Primary Colors (Türkis wie Payment-Portal) */
    --primary: #6DB3B0;
    --primary-dark: #5A9F9C;
    --primary-light: #8BC5C2;
    
    /* HLP7 CI Colors */
    --accent: #8B9680;          /* Salbeigrün */
    --accent-light: #A5B299;
    
    /* Status Colors */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* Neutrals */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f5f7fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

/* =============================================================================
   LAYOUT
   ============================================================================= */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-wrapper {
    padding: 30px;
    max-width: 1600px;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-logo i {
    font-size: 1.8rem;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 12px 25px;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    border-left-color: var(--white);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 15px 20px;
}

.nav-label {
    padding: 10px 25px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}

/* =============================================================================
   HEADER
   ============================================================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-800);
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin-top: 5px;
}

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* =============================================================================
   STAT CARDS
   ============================================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(109, 179, 176, 0.15); color: var(--primary); }
.stat-icon.success { background: rgba(40, 167, 69, 0.15); color: var(--success); }
.stat-icon.warning { background: rgba(255, 193, 7, 0.15); color: var(--warning); }
.stat-icon.danger { background: rgba(220, 53, 69, 0.15); color: var(--danger); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-label {
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* =============================================================================
   TABLES
   ============================================================================= */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: var(--gray-50);
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* =============================================================================
   BADGES
   ============================================================================= */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Status Badges */
.badge-new { background: #e3f2fd; color: #1565c0; }
.badge-open { background: #fff3e0; color: #ef6c00; }
.badge-pending { background: #fce4ec; color: #c2185b; }
.badge-resolved { background: #e8f5e9; color: #2e7d32; }
.badge-closed { background: var(--gray-200); color: var(--gray-600); }

/* Priority Badges */
.priority-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-low { background: var(--gray-200); color: var(--gray-600); }
.priority-normal { background: #e3f2fd; color: #1565c0; }
.priority-high { background: #fff3e0; color: #ef6c00; }
.priority-urgent { background: #ffebee; color: #c62828; }

/* Role Badges */
.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.role-admin { background: #f3e5f5; color: #7b1fa2; }
.role-second { background: #e3f2fd; color: #1565c0; }
.role-first { background: var(--gray-200); color: var(--gray-600); }

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(109, 179, 176, 0.3);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

/* =============================================================================
   FORMS
   ============================================================================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(109, 179, 176, 0.2);
}

.form-control.error {
    border-color: var(--danger);
}

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

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* =============================================================================
   ALERTS
   ============================================================================= */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

/* =============================================================================
   TICKET SPECIFIC
   ============================================================================= */
.ticket-row {
    cursor: pointer;
}

.ticket-number {
    font-family: 'Consolas', monospace;
    font-weight: 600;
    color: var(--primary);
}

.ticket-subject {
    font-weight: 500;
}

.ticket-customer {
    display: flex;
    flex-direction: column;
}

.customer-email {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Ticket Detail */
.ticket-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 25px;
    background: var(--gray-50);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.ticket-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 25px;
    border-bottom: 1px solid var(--gray-200);
}

.ticket-info-item {
    display: flex;
    flex-direction: column;
}

.ticket-info-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.ticket-info-value {
    font-weight: 500;
}

/* Messages */
.messages-container {
    padding: 25px;
    max-height: 500px;
    overflow-y: auto;
}

.message {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
}

.message-customer {
    background: var(--gray-100);
    margin-right: 50px;
}

.message-agent {
    background: rgba(109, 179, 176, 0.1);
    margin-left: 50px;
    border-left: 3px solid var(--primary);
}

.message-internal {
    background: #fff3cd;
    margin-left: 50px;
    border-left: 3px solid var(--warning);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.message-sender {
    font-weight: 600;
}

.message-time {
    color: var(--gray-500);
}

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

/* Customer Info Panel */
.customer-panel {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.customer-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 15px;
}

.customer-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.customer-details {
    padding: 20px;
}

.customer-detail-item {
    margin-bottom: 15px;
}

.customer-detail-item i {
    width: 20px;
    color: var(--gray-500);
    margin-right: 10px;
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.login-title {
    font-size: 1.5rem;
    color: var(--gray-800);
}

.login-subtitle {
    color: var(--gray-600);
}

/* =============================================================================
   UTILITIES
   ============================================================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-600); }
.text-small { font-size: 0.85rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .ticket-info {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .message-customer,
    .message-agent,
    .message-internal {
        margin-left: 0;
        margin-right: 0;
    }
}

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