/* ============================================
   CallADoc - Styles
   Touch-optimiert für Behandlungsstühle
   ============================================ */

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --success: #10B981;
    --success-dark: #059669;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-dark: #DC2626;
    
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ============================================
   Screens
   ============================================ */

.screen {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ============================================
   Login Screen
   ============================================ */

#login-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    background: white;
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin: 20px;
}

.login-logo {
    color: var(--primary);
    margin-bottom: 16px;
}

.login-container h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#login-password {
    padding: 16px;
    font-size: 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: border-color 0.2s;
}

#login-password:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    min-height: 20px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--gray-600);
}

.btn-icon:hover {
    background: var(--gray-200);
}

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

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

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-select {
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
}

.room-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================
   Team Section
   ============================================ */

.team-section {
    padding: 24px;
    overflow-x: auto;
}

.team-grid {
    display: flex;
    gap: 16px;
    min-height: 80px;
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    min-width: 120px;
    background: white;
    border: 3px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.team-member:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.team-member.selected {
    border-color: var(--primary);
    background: var(--gray-50);
}

.team-member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 8px;
}

.team-member-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
}

.team-member-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================
   Chat Section
   ============================================ */

.chat-section {
    flex: 1;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 12px 0;
    font-size: 14px;
    color: var(--gray-600);
}

.chat-header strong {
    color: var(--primary);
}

.chat-input-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#message-input {
    flex: 1;
    padding: 16px;
    font-size: 18px;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    resize: none;
    min-height: 100px;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-options {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-600);
}

.checkbox-label input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================
   Action Buttons
   ============================================ */

.actions-section {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: white;
    border-top: 1px solid var(--gray-200);
}

.btn-action {
    flex: 1;
    padding: 20px;
    font-size: 18px;
    border-radius: var(--radius);
}

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

.btn-ping:hover:not(:disabled) {
    background: #D97706;
}

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

.btn-templates:hover:not(:disabled) {
    background: var(--gray-300);
}

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

.btn-send:hover:not(:disabled) {
    background: var(--success-dark);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 700px;
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    font-size: 28px;
    line-height: 1;
    padding: 4px 8px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

/* ============================================
   Templates List
   ============================================ */

.templates-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.template-item {
    padding: 16px;
    margin-bottom: 8px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.template-item:hover {
    background: var(--gray-100);
}

.template-item:active {
    background: var(--gray-200);
}

.template-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.template-content {
    font-size: 14px;
    color: var(--gray-600);
}

.template-category {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    font-size: 12px;
    background: var(--gray-200);
    border-radius: 4px;
    color: var(--gray-600);
}

/* ============================================
   Settings Tabs
   ============================================ */

.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    flex: 1;
    padding: 16px;
    font-size: 14px;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
}

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

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-list {
    margin-bottom: 24px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.settings-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-item-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.settings-item-name {
    font-weight: 600;
}

.settings-item-meta {
    font-size: 12px;
    color: var(--gray-500);
}

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

.btn-delete {
    padding: 8px;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-delete:hover {
    background: var(--gray-200);
}

.add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.add-form input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    font-size: 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.add-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.add-form input[type="color"] {
    width: 48px;
    height: 48px;
    padding: 4px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ============================================
   Toast Notifications
   ============================================ */

#toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 16px 24px;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }
    
    .team-section {
        padding: 16px;
    }
    
    .team-member {
        min-width: 100px;
        padding: 12px 16px;
    }
    
    .chat-section {
        padding: 0 16px;
    }
    
    .actions-section {
        padding: 16px;
        gap: 12px;
    }
    
    .btn-action {
        padding: 16px 12px;
        font-size: 14px;
    }
    
    .btn-action svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .btn-action span {
        display: none;
    }
    
    .btn-action {
        padding: 16px;
    }
}

/* ============================================
   Station Selection Screen
   ============================================ */

#station-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.station-container {
    background: white;
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.station-container h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
}

.station-group {
    margin-bottom: 24px;
}

.station-group h3 {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.station-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: white;
    border: 3px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.station-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.station-btn .station-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.station-btn .station-name {
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
}

/* ============================================
   Updated Header
   ============================================ */

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

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .station-icon {
    font-size: 28px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-subtitle {
    font-size: 12px;
    color: var(--gray-500);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   Inbox Section
   ============================================ */

.inbox-section {
    padding: 16px 20px;
    max-height: 35vh;
    overflow-y: auto;
    border-bottom: 1px solid var(--gray-200);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.inbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inbox-message {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.inbox-message.unread {
    background: #EFF6FF;
    border-color: var(--primary);
}

.inbox-message:hover {
    box-shadow: var(--shadow);
}

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

.message-sender {
    font-weight: 600;
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: var(--gray-400);
}

.message-content {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.4;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.message-response {
    margin-top: 8px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.message-response.positive {
    background: #D1FAE5;
    color: #065F46;
}

.message-response.negative {
    background: #FEE2E2;
    color: #991B1B;
}

.empty-state {
    text-align: center;
    color: var(--gray-400);
    padding: 20px;
    font-size: 14px;
}

/* ============================================
   Send Section
   ============================================ */

.send-section {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.recipient-selector {
    margin-bottom: 16px;
    overflow-x: auto;
}

.recipient-grid {
    display: flex;
    gap: 10px;
    padding-bottom: 8px;
}

.recipient-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    min-width: 90px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.recipient-item:hover {
    border-color: var(--primary);
}

.recipient-item.selected {
    border-color: var(--primary);
    background: #EFF6FF;
}

.recipient-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.recipient-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
    white-space: nowrap;
}

.message-composer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.composer-header {
    padding: 10px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-600);
}

.composer-header strong {
    color: var(--primary);
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    border: none;
    resize: none;
    min-height: 80px;
}

#message-input:focus {
    outline: none;
}

.composer-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.composer-actions .btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
}

/* ============================================
   Button Variants
   ============================================ */

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

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

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

.btn-warning:hover:not(:disabled) {
    background: #D97706;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

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

/* ============================================
   Login Logo Update
   ============================================ */

.login-logo {
    font-size: 64px;
    margin-bottom: 16px;
}
