/* ==========================================
   Voice2Mail v2.0 - Modern UI
   Engel-Apotheke Trossingen
   ========================================== */

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

:root {
    /* Corporate Colors */
    --color-primary-red: #c31c4a;
    --color-primary-red-dark: #a81740;
    --color-primary-red-light: #d8335e;
    --color-anthracite: #323e48;
    --color-anthracite-light: #3d4850;
    --color-green: #9dd8b3;
    --color-green-dark: #8bcca3;
    --color-turquoise: #61b9af;

    /* Neutrals */
    --color-bg-primary: #F5F7FA;
    --color-bg-secondary: #FAFBFC;
    --color-bg-tertiary: #F8F9FB;
    --color-border-light: #F0F2F5;
    --color-border-medium: #E8EAED;
    --color-border-dark: #D1D5DB;

    /* Text Colors */
    --color-text-primary: #1A1D1F;
    --color-text-secondary: #4B5563;
    --color-text-tertiary: #6B7280;
    --color-text-light: #9CA3AF;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.08);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables - Softened Colors */
body.dark-mode {
    /* Noch dunklere, angenehmere Hintergründe */
    --color-bg-primary: #1e2227;      /* Deutlich dunkler */
    --color-bg-secondary: #252a30;    /* Dunkler */
    --color-bg-tertiary: #2d3339;     /* Sanft abgestuft */

    /* Borders mit noch weniger Kontrast */
    --color-border-light: #353a42;
    --color-border-medium: #3d424a;
    --color-border-dark: #484d55;

    /* Gedämpfte Texte - kein grelles Weiß */
    --color-text-primary: #d4d7db;    /* Deutlich weniger grell */
    --color-text-secondary: #a8adb5;  /* Noch weicher */
    --color-text-tertiary: #7a8088;   /* Sehr dezent */
    --color-text-light: #5a6168;

    /* Sehr weiche Schatten */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.2);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.25);

    /* Anthrazit-Töne für Dark Mode */
    --color-anthracite: #454b55;
    --color-anthracite-light: #4f5560;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   TOP HEADER BAR
   ========================================== */

.top-header {
    height: 108px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    box-shadow: var(--shadow-sm);
    z-index: 200;
}

body.dark-mode .top-header {
    background: var(--color-bg-tertiary);
    border-bottom-color: var(--color-border-medium);
}

.header-logo {
    display: flex;
    align-items: center;
    position: relative;
}

.header-logo img {
    height: calc(72px * 0.9); /* 90% of header height */
    width: auto;
    object-fit: contain;
}

/* Logo switching for light/dark mode */
.header-logo .logo-dark {
    display: none;
}

body.dark-mode .header-logo .logo-light {
    display: none;
}

body.dark-mode .header-logo .logo-dark {
    display: block;
}

.header-search {
    flex: 1;
    max-width: 600px;
    margin: 0 32px;
}

.header-search .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search .search-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.header-search .search-input {
    width: 100%;
    padding: 10px 44px 10px 48px;
    border: 1.5px solid var(--color-border-medium);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.header-search .search-input:focus {
    outline: none;
    border-color: var(--color-primary-red);
    box-shadow: 0 0 0 3px rgba(195, 28, 74, 0.1);
    background: #FFFFFF;
}

body.dark-mode .header-search .search-input:focus {
    background: var(--color-bg-secondary);
}

.header-search .search-input::placeholder {
    color: var(--color-text-light);
}

.header-search .clear-search {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.header-search .clear-search.visible {
    display: flex;
}

.header-search .clear-search svg {
    width: 14px;
    height: 14px;
}

.header-search .clear-search:hover {
    background: var(--color-border-light);
    color: var(--color-text-primary);
}

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

.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--color-bg-primary);
    border: 1.5px solid var(--color-border-medium);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

.header-btn:hover {
    background: var(--color-border-light);
    border-color: var(--color-border-dark);
    color: var(--color-text-primary);
    transform: translateY(-1px);
}

.header-btn.active {
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-primary-red-dark) 100%);
    border-color: var(--color-primary-red);
    color: white;
}

.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */

.sidebar {
    width: 72px;
    background: linear-gradient(180deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    box-shadow: 4px 0 16px rgba(50, 62, 72, 0.12);
    position: relative;
    z-index: 100;
}

.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
}

.nav-item {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: rgba(255,255,255,0.5);
    position: relative;
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    transform: translateY(-1px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-primary-red-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(195, 28, 74, 0.4);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    width: 3px;
    height: 28px;
    background: var(--color-primary-red);
    border-radius: 0 3px 3px 0;
}

.nav-spacer {
    flex: 1;
}

/* ==========================================
   MESSAGE LIST PANEL
   ========================================== */

.message-list-panel {
    width: 380px;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}

.panel-header {
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    color: white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.panel-header-content {
    flex: 1;
}

.panel-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.panel-header p {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
}

.panel-refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.panel-refresh-btn svg {
    width: 18px;
    height: 18px;
}

.panel-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.panel-refresh-btn.refreshing {
    pointer-events: none;
    opacity: 0.7;
}

.panel-refresh-btn.refreshing svg {
    animation: spin 0.6s linear infinite;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 20px;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    color: var(--color-text-tertiary);
    font-size: 14px;
}

/* Category Sections */
.category-section {
    border-bottom: 1px solid var(--color-border-light);
}

.category-header {
    padding: 16px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fb 0%, #f5f7fa 100%);
    transition: all var(--transition-fast);
    user-select: none;
    border-bottom: 1px solid var(--color-border-light);
}

body.dark-mode .category-header {
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%);
}

.category-header:hover {
    background: linear-gradient(135deg, #eef2f6 0%, #e8ecf0 100%);
    border-left: 3px solid var(--color-primary-red);
    padding-left: 21px;
}

body.dark-mode .category-header:hover {
    background: linear-gradient(135deg, #3a3e44 0%, #2f3338 100%);
}

.category-header.active {
    background: linear-gradient(90deg, rgba(195, 28, 74, 0.08) 0%, rgba(195, 28, 74, 0.03) 100%);
    border-left: 3px solid var(--color-primary-red);
    padding-left: 21px;
}

body.dark-mode .category-header.active {
    background: linear-gradient(90deg, rgba(195, 28, 74, 0.15) 0%, rgba(195, 28, 74, 0.05) 100%);
}

.category-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    width: 20px;
    height: 20px;
    color: var(--color-text-tertiary);
    transition: color var(--transition-fast);
}

.category-header.active .category-icon {
    color: var(--color-anthracite);
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-count {
    background: var(--color-border-light);
    color: var(--color-text-tertiary);
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.category-header.active .category-count {
    background: linear-gradient(135deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(50, 62, 72, 0.2);
}

.category-arrow {
    width: 16px;
    height: 16px;
    color: var(--color-text-light);
    transition: transform var(--transition-smooth);
}

.category-header.active .category-arrow {
    transform: rotate(180deg);
}

.category-messages {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-smooth);
    background: var(--color-bg-secondary);
}

.category-messages.expanded {
    max-height: 2000px;
}

/* Message Items */
.message-item {
    background: #FFFFFF;
    border-bottom: 1px solid var(--color-border-light);
    padding: 16px 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.message-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-primary-red-dark) 100%);
    transition: width var(--transition-fast);
}

.message-item:hover {
    background: var(--color-bg-tertiary);
    transform: translateX(2px);
}

.message-item.active::before {
    width: 3px;
}

.message-item.active {
    background: linear-gradient(90deg, #FFF5F7 0%, #FFFFFF 100%);
    padding-left: 21px;
}

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

.patient-name {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 14px;
    letter-spacing: -0.01em;
}

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

.message-preview {
    font-size: 13px;
    color: var(--color-text-tertiary);
    line-height: 1.5;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.message-meta-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.doctor-tag {
    background: var(--color-border-light);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.employee-badge {
    background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-dark) 100%);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 11px;
    color: #1e5a3a;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.employee-badge svg {
    width: 12px;
    height: 12px;
}

.status-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-urgent {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #991B1B;
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #FFFFFF;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    padding: 40px;
    color: var(--color-text-tertiary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    opacity: 0.3;
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.empty-state p {
    font-size: 14px;
    text-align: center;
    max-width: 400px;
}

/* Content Header */
.content-header {
    background: #FFFFFF;
    padding: 32px 36px 24px;
    border-bottom: 2px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.content-title-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.content-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    line-height: 1.2;
    margin-bottom: 2px;
}

.content-employee {
    font-size: 13px;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.content-employee svg {
    width: 14px;
    height: 14px;
    color: var(--color-green);
}

/* Message Detail */
.message-detail {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--color-bg-primary);
}

.detail-section {
    background: #FFFFFF;
    border: 1px solid var(--color-border-medium);
    border-radius: 10px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

.detail-section:hover {
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--color-bg-primary);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-anthracite);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    width: 20px;
    height: 20px;
    color: var(--color-anthracite);
}

/* Buttons */
.btn {
    padding: 11px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
    font-family: inherit;
}

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

.btn-secondary {
    background: var(--color-bg-primary);
    color: var(--color-anthracite);
    border: 1.5px solid var(--color-border-medium);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border-medium);
    border-color: var(--color-border-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(50, 62, 72, 0.2);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(50, 62, 72, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-primary-red-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(195, 28, 74, 0.25);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(195, 28, 74, 0.35);
}

.btn-danger {
    background: #FFFFFF;
    color: #DC2626;
    border: 1.5px solid #FCA5A5;
}

.btn-danger:hover:not(:disabled) {
    background: #FEF2F2;
    border-color: #F87171;
    transform: translateY(-1px);
}

.btn-outline {
    background: #FFFFFF;
    border: 1.5px solid var(--color-border-medium);
    color: var(--color-anthracite);
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-bg-tertiary);
    border-color: var(--color-anthracite);
    transform: translateY(-1px);
}

/* Audio Player */
.audio-player {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-primary) 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border-medium);
}

/* Compact Audio Player (under transcript) */
.audio-player-compact {
    margin-top: 16px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
}

.audio-player-compact .play-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    box-shadow: 0 2px 6px rgba(195, 28, 74, 0.2);
}

.audio-player-compact .play-button:hover {
    box-shadow: 0 3px 10px rgba(195, 28, 74, 0.3);
    transform: scale(1.05);
}

.audio-player-compact .play-button svg {
    width: 12px;
    height: 12px;
}

.audio-player-compact .play-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--color-bg-tertiary);
    box-shadow: none;
}

.audio-player-compact .play-button:disabled:hover {
    transform: none;
    box-shadow: none;
}

.audio-player-compact .audio-duration {
    font-size: 12px;
    margin-bottom: 8px;
    color: var(--color-text-light);
}

.audio-player-compact .waveform {
    height: 24px;
}

.play-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(50, 62, 72, 0.25);
}

.play-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(50, 62, 72, 0.35);
}

.play-button svg {
    width: 16px;
    height: 16px;
}

.audio-info {
    flex: 1;
}

.audio-duration {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
    font-weight: 500;
}

.waveform {
    height: 36px;
    background: linear-gradient(90deg, var(--color-border-medium) 0%, var(--color-border-medium) 60%, var(--color-border-light) 100%);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    --progress: 0%;
}

.waveform::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: var(--progress, 0%);
    height: 100%;
    background: linear-gradient(90deg, #c31c4a 0%, rgba(195, 28, 74, 0.8) 100%);
    z-index: 1;
}

.transcript-text {
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-primary) 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--color-primary-red);
    color: var(--color-text-secondary);
    line-height: 1.7;
    font-size: 13px;
    margin-bottom: 0;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-anthracite);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.form-input, .form-textarea, .form-select, .form-editor {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border-medium);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: #FFFFFF;
    color: var(--color-text-primary);
}

.form-input:focus, .form-textarea:focus, .form-select:focus, .form-editor:focus {
    outline: none;
    border-color: var(--color-anthracite);
    box-shadow: 0 0 0 3px rgba(50, 62, 72, 0.1);
    background: var(--color-bg-secondary);
}

.form-textarea {
    resize: vertical;
    min-height: 200px;
    line-height: 1.7;
}

.form-editor {
    min-height: 200px;
    line-height: 1.7;
    overflow-y: auto;
    max-height: 500px;
}

.form-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-light);
    pointer-events: none;
}

.form-editor p {
    margin: 0 0 1em 0;
}

.form-editor p:last-child {
    margin-bottom: 0;
}

.form-editor strong, .form-editor b {
    font-weight: 600;
}

.form-editor em, .form-editor i {
    font-style: italic;
}

.form-editor ul, .form-editor ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.form-editor li {
    margin: 0.25em 0;
}

/* Recipient Info */
.recipient-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-primary) 100%);
    border-radius: 8px;
    border: 1px solid var(--color-border-medium);
}

.recipient-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-anthracite-light) 0%, var(--color-anthracite) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(50, 62, 72, 0.2);
}

.recipient-details h4 {
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: 5px;
    font-weight: 600;
}

.recipient-details p {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    padding-top: 12px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1280px) {
    .message-list-panel {
        width: 320px;
    }

    .message-detail {
        padding: 24px;
    }
}

@media (max-width: 1024px) {
    .message-list-panel {
        width: 280px;
    }

    .panel-header {
        padding: 24px 16px 20px;
    }

    .message-item {
        padding: 14px 16px;
    }

    .category-header {
        padding: 14px 16px;
    }
}

@media (max-width: 768px) {
    .message-list-panel {
        position: absolute;
        left: 72px;
        top: 0;
        bottom: 0;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform var(--transition-smooth);
    }

    .message-list-panel.visible {
        transform: translateX(0);
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* ==========================================
   SEARCH & FILTER BAR
   ========================================== */

.search-filter-bar {
    padding: 16px 20px;
    background: #FFFFFF;
    border-bottom: 2px solid var(--color-border-light);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-smooth), padding var(--transition-smooth);
    position: relative;
    z-index: 50;
}

body.dark-mode .search-filter-bar {
    background: var(--color-bg-secondary);
}

.search-filter-bar.visible {
    max-height: 200px;
    padding: 16px 20px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    border: 1.5px solid var(--color-border-medium);
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary-red);
    box-shadow: 0 0 0 3px rgba(195, 28, 74, 0.1);
    background: #FFFFFF;
}

body.dark-mode .search-input:focus {
    background: var(--color-bg-tertiary);
}

.search-input::placeholder {
    color: var(--color-text-light);
}

.clear-search {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.clear-search.visible {
    display: flex;
}

.clear-search svg {
    width: 14px;
    height: 14px;
}

.clear-search:hover {
    background: var(--color-border-light);
    color: var(--color-text-primary);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.toast-container {
    position: fixed;
    top: 88px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 320px;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--toast-color, var(--color-anthracite));
}

body.dark-mode .toast {
    background: var(--color-bg-tertiary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
}

.toast.removing {
    animation: toastSlideOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 14px;
    height: 14px;
}

.toast.success {
    --toast-color: var(--color-green);
}

.toast.success .toast-icon {
    background: var(--color-green);
    color: #1e5a3a;
}

.toast.error {
    --toast-color: #DC2626;
}

.toast.error .toast-icon {
    background: #FEE2E2;
    color: #DC2626;
}

.toast.warning {
    --toast-color: #F59E0B;
}

.toast.warning .toast-icon {
    background: #FEF3C7;
    color: #D97706;
}

.toast.info {
    --toast-color: var(--color-primary-red);
}

.toast.info .toast-icon {
    background: rgba(195, 28, 74, 0.15);
    color: var(--color-primary-red);
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.toast-close {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-close:hover {
    background: var(--color-border-light);
    color: var(--color-text-primary);
}

/* ==========================================
   AUDIO PLAYER - RED ACCENT
   ========================================== */

.play-button {
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-primary-red-dark) 100%) !important;
    box-shadow: 0 4px 12px rgba(195, 28, 74, 0.3) !important;
}

.play-button:hover {
    box-shadow: 0 6px 18px rgba(195, 28, 74, 0.4) !important;
}

.waveform::after {
    background: linear-gradient(90deg, var(--color-primary-red) 0%, var(--color-primary-red-light) 100%) !important;
}

/* ==========================================
   MODAL / CONFIRM DIALOG
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.visible {
    display: flex;
}

.modal-dialog {
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 480px;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .modal-dialog {
    background: var(--color-bg-tertiary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

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

.modal-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-body {
    padding: 28px;
}

.modal-body p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
}

.modal-footer {
    padding: 20px 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--color-border-light);
}

.modal-footer .btn {
    min-width: 100px;
}

/* Recipient select removed - see duplicate below */

.recipient-dropdown-OLD {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--color-border-medium);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color 0.15s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

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

.dropdown-item-title {
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.dropdown-item-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.dropdown-empty {
    color: var(--color-text-secondary);
    text-align: center;
    padding: 20px;
    cursor: default;
}

.dropdown-empty:hover {
    background-color: transparent;
}

/* ==========================================
   FORM MODAL STYLES
   ========================================== */

.form-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-modal {
    background: var(--color-bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.form-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-modal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light);
    border-radius: 10px;
}

.form-modal-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-primary);
}

.form-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.form-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.form-modal-field {
    margin-bottom: 20px;
}

.form-modal-field:last-child {
    margin-bottom: 0;
}

.form-modal-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.required-mark {
    color: var(--color-danger);
    margin-left: 4px;
}

.form-modal-input,
.form-modal-textarea,
.form-modal-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border-medium);
    border-radius: 8px;
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    transition: all 0.2s ease;
}

.form-modal-input:focus,
.form-modal-textarea:focus,
.form-modal-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(195, 28, 74, 0.1);
}

.form-modal-input.error,
.form-modal-textarea.error,
.form-modal-select.error {
    border-color: var(--color-danger);
}

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

.form-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--color-bg-secondary);
}

/* ==========================================
   RECIPIENT SELECT STYLES
   ========================================== */

.recipient-select-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
    position: relative;
}

.recipient-select-wrapper .form-input {
    flex: 1;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.recipient-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-medium);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    width: calc(100% - 110px);
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
    transition: background 0.2s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

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

.dropdown-item-title {
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.dropdown-item-subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.dropdown-empty {
    color: var(--color-text-secondary);
    text-align: center;
    padding: 20px;
    cursor: default;
}

