@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-title: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #0f172a;
    --text-medium: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    
    /* Premium Indigo/Violet Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #f5f3ff;
    
    /* Status Colors */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #047857;
    
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #b45309;
    
    --error: #ef4444;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
    
    --info-bg: #f0f9ff;
    --info-text: #0369a1;
    
    /* Shadows & Border Radius */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* Glassmorphic Sticky Topbar */
.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px 40px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    color: var(--text);
    display: inline-flex;
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 700;
    gap: 10px;
    min-width: 0;
}

.brand:hover {
    color: var(--text);
}

.brand img {
    display: block;
    height: 32px;
    object-fit: contain;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

.brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.topbar nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.topbar nav a {
    border-radius: var(--radius-sm);
    color: var(--text-medium);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
}

.topbar nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.container {
    margin: 0 auto;
    max-width: 1200px;
    padding: 40px 40px;
}

/* Headings & Typography */
.page-head {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 32px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-title);
    color: var(--text);
    margin-top: 0;
    font-weight: 700;
}

h1 {
    font-size: 28px;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 6px;
}

h2 {
    font-size: 20px;
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin-bottom: 20px;
}

.page-head p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 0;
}

/* Base Cards / Panels */
.auth-panel,
.form,
.table-wrap,
.message,
.reply-box,
.ticket-meta,
.notice {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Auth Panel */
.auth-panel {
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    margin: 80px auto;
    max-width: 420px;
    padding: 40px 32px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.auth-panel h1 {
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.auth-logo {
    display: block;
    height: 48px;
    margin: 0 auto 24px auto;
    object-fit: contain;
    width: auto;
}

/* Modern Form Fields */
.form {
    display: grid;
    gap: 20px;
    max-width: 680px;
    padding: 32px;
}

.form.wide {
    max-width: 900px;
}

label {
    color: var(--text-medium);
    display: grid;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea,
button,
.button {
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid var(--line-strong);
    color: var(--text);
    min-height: 44px;
    outline: 0;
    padding: 10px 14px;
    transition: var(--transition);
    width: 100%;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

button,
.button {
    align-items: center;
    background: var(--primary);
    border: 0;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 600;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    transition: var(--transition);
    font-size: 14px;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    color: #ffffff;
    text-decoration: none;
}

button:active,
.button:active {
    transform: scale(0.98);
}

.grid.two {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Modern Minimalist Tables */
.table-wrap {
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--line);
}

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

th,
td {
    padding: 16px 20px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

td {
    border-bottom: 1px solid var(--line);
    color: var(--text-medium);
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.02);
}

tbody tr:last-child td {
    border-bottom: 0;
}

td a {
    font-weight: 600;
}

small {
    color: var(--muted);
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

/* Status Pill Badges */
.badge {
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 6px 12px;
    gap: 6px;
}

.badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-open {
    background: #e0f2fe;
    color: #0369a1;
}
.status-open::before {
    background: #0284c7;
    box-shadow: 0 0 8px #0284c7;
}

.status-pending {
    background: var(--warning-bg);
    color: var(--warning-text);
}
.status-pending::before {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-closed {
    background: #f1f5f9;
    color: #475569;
}
.status-closed::before {
    background: #64748b;
}

/* Alerts */
.alert {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.alert.success {
    background: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-text);
}

.alert.error {
    background: var(--error-bg);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--error-text);
}

/* Ticket Info Banner */
.ticket-meta {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 24px;
    overflow: hidden;
}

.ticket-meta div {
    border-right: 1px solid var(--line);
    padding: 20px 24px;
}

.ticket-meta div:last-child {
    border-right: 0;
}

.ticket-meta strong {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-meta span {
    font-weight: 600;
    color: var(--text);
}

/* Client URL Notice */
.notice {
    background: var(--info-bg);
    border: 1px solid rgba(3, 105, 161, 0.15);
    color: var(--info-text);
    margin-bottom: 24px;
    padding: 16px 20px;
}

.notice strong {
    color: var(--info-text);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.notice a {
    color: #0284c7;
    font-weight: 500;
    word-break: break-all;
}

.notice a:hover {
    text-decoration: underline;
}

/* Public view shell */
.public-shell {
    margin: 0 auto;
    max-width: 900px;
}

/* Timeline & Message bubbles */
.timeline {
    display: grid;
    gap: 20px;
}

.message {
    padding: 24px;
    transition: var(--transition);
    position: relative;
    border-left: 3px solid var(--line);
}

/* Agent (Destek Ekibi) Message style */
.message.agent {
    background: #fafcff;
    border-color: var(--primary);
    border-left-width: 4px;
}

/* Client (Requester) Message style */
.message.client {
    background: var(--panel);
    border-color: #cbd5e1;
    border-left-width: 4px;
}

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

.message header strong {
    font-size: 15px;
    font-family: var(--font-title);
    color: var(--text);
}

.message header span {
    color: var(--muted);
    font-size: 13px;
}

.message header time {
    color: var(--muted);
    font-size: 12px;
    margin-left: auto;
}

.message p {
    color: var(--text-medium);
    margin: 0;
    font-size: 14.5px;
    line-height: 1.65;
    white-space: pre-line;
}

/* Sender type badge */
.sender-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.sender-type.agent-badge {
    background: #e0e7ff;
    color: #3730a3;
}

.sender-type.client-badge {
    background: #f1f5f9;
    color: #475569;
}

/* File attachments */
.attachment {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    color: var(--text-medium);
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    margin: 16px 8px 0 0;
    padding: 8px 12px;
    gap: 6px;
    transition: var(--transition);
}

.attachment:hover {
    background: #e2e8f0;
    color: var(--text);
}

.attachment::before {
    content: "📎";
    font-size: 14px;
}

/* Reply Box */
.reply-box {
    margin-top: 32px;
    padding: 32px;
}

.reply-box h2 {
    margin-bottom: 24px;
}

.reply-box .form {
    border: 0;
    padding: 0;
    box-shadow: none;
}

/* Inline actions (status update) */
.inline-form {
    align-items: center;
    display: flex;
    gap: 12px;
}

.inline-form select {
    min-width: 160px;
    min-height: 40px;
}

.inline-form button {
    min-height: 40px;
}

/* Action forms / user list buttons */
.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions form {
    margin: 0;
}

.actions button {
    background: #f1f5f9;
    color: var(--text-medium);
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
}

.actions button:hover {
    background: #e2e8f0;
    color: var(--text);
    box-shadow: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .topbar {
        padding: 16px 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .topbar nav {
        justify-content: flex-start;
    }

    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .container {
        padding: 24px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .grid.two,
    .ticket-meta {
        grid-template-columns: 1fr;
    }

    .ticket-meta div {
        border-bottom: 1px solid var(--line);
        border-right: 0;
    }

    .ticket-meta div:last-child {
        border-bottom: 0;
    }

    th,
    td {
        padding: 12px 14px;
    }

    .message header time {
        margin-left: 0;
        width: 100%;
        margin-top: 4px;
    }
}
