/* Konferans QR Mesaj Uygulaması - Genel Stiller */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* --- Genel düzen --- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-narrow {
    max-width: 520px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* --- Kart --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
}

.card-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.card-subtitle {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
}

/* --- Butonlar --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

/* --- Form --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.35rem;
}

/* --- Uyarı kutuları --- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* --- Ana sayfa hero --- */
.hero {
    text-align: center;
    padding: 3rem 1.5rem;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: 2rem;
    margin: 0 0 0.75rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 480px;
    margin: 0 auto 2rem;
}

/* --- QR sayfası --- */
.qr-page {
    text-align: center;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    color: #fff;
}

.qr-page h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0 0 0.5rem;
}

.qr-page .subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    opacity: 0.85;
    margin-bottom: 2rem;
}

.qr-wrapper {
    background: #fff;
    padding: 1.5rem;
    border-radius: 16px;
    display: inline-block;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* qrcodejs canvas + img ikisini de üretir; yalnızca img göster */
#qrcode canvas {
    display: none !important;
}

#qrcode img {
    display: block !important;
    max-width: min(400px, 80vw);
    height: auto !important;
}

.qr-url {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    opacity: 0.7;
    word-break: break-all;
}

/* --- Admin paneli --- */
.admin-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    background: #0f172a;
    color: #fff;
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex-shrink: 0;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.admin-header .meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    opacity: 0.9;
    flex-wrap: wrap;
}

.admin-header a {
    color: #93c5fd;
    text-decoration: none;
}

.admin-header a:hover {
    text-decoration: underline;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
    margin-left: 0.5rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Tablet uyumlu bölünmüş panel */
.admin-split {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.admin-list-panel {
    width: 38%;
    min-width: 260px;
    max-width: 420px;
    border-right: 1px solid var(--border);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-title {
    padding: 0.875rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.message-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.message-list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.message-list-item:hover {
    background: #f1f5f9;
}

.message-list-item.is-active {
    background: #dbeafe;
    border-left: 4px solid var(--primary);
    padding-left: calc(1rem - 4px);
}

/* Okunmamış mesaj */
.message-list-item.is-unread {
    background: #eff6ff;
}

.message-list-item.is-unread .list-name {
    font-weight: 700;
    color: var(--text);
}

.message-list-item.is-read {
    background: var(--card-bg);
}

.message-list-item.is-read .list-name {
    font-weight: 400;
    color: var(--text-muted);
}

.unread-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
}

.list-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.list-empty,
.list-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* Sağ detay paneli */
.admin-detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg);
}

.detail-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.detail-empty[hidden],
.detail-content[hidden] {
    display: none !important;
}

.detail-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.detail-content {
    max-width: 720px;
}

.detail-header {
    margin-bottom: 1rem;
}

.detail-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.detail-time {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-email {
    margin: 0 0 1.25rem;
    color: var(--primary);
    font-size: 0.95rem;
    word-break: break-all;
}

.detail-message {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 120px;
    box-shadow: var(--shadow);
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

/* Sunum ekranı */
.display-screen {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #fff;
}

.display-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.display-waiting {
    text-align: center;
    opacity: 0.7;
}

.display-waiting-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.display-message {
    max-width: 900px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.display-name {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 2rem;
    opacity: 0.9;
}

.display-text {
    font-size: clamp(1.75rem, 5vw, 3.5rem);
    line-height: 1.4;
    margin: 0 0 2rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.display-meta {
    font-size: 1rem;
    opacity: 0.6;
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Login --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Responsive --- */
@media (min-width: 576px) {
    .btn-group {
        flex-direction: row;
        justify-content: center;
    }

    .btn-group .btn {
        min-width: 180px;
    }
}

@media (max-width: 767px) {
    .admin-split {
        flex-direction: column;
    }

    .admin-list-panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .admin-detail-panel {
        padding: 1rem;
    }

    .detail-header h2 {
        font-size: 1.25rem;
    }

    .detail-message {
        font-size: 1rem;
    }
}

@media (max-width: 575px) {
    .card {
        padding: 1.5rem;
    }
}
