/* =====================================================
   AI Call Panel - Modern Premium Tema
   ===================================================== */

/* CSS Değişkenleri */
:root {
    /* Ana renkler */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --secondary: #64748b;
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --info: #0ea5e9;

    /* Nötr renkler */
    --bg: #f8fafc;
    --bg-dark: #0f172a;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Boyutlar */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Gölgeler */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Geçişler */
    --transition: all 0.2s ease;
    --transition-fast: all 0.15s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 100%);
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 44px;
}

/* =====================================================
   CONTAINER
   ===================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* =====================================================
   DIALER SECTION
   ===================================================== */
.dialer-section {
    margin-bottom: 24px;
}

.dialer-card {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 50%, #7c3aed 100%);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.dialer-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.dialer-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.dialer-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.dialer-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.dialer-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.dialer-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

.dialer-body {
    position: relative;
    z-index: 1;
}

.dialer-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper .optional {
    font-weight: 400;
    text-transform: none;
    opacity: 0.7;
}

.input-wrapper input {
    padding: 14px 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.input-wrapper input::placeholder {
    color: rgba(255,255,255,0.5);
}

.input-wrapper input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.15);
}

.phone-input-container {
    display: flex;
    align-items: stretch;
}

.country-code {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.2);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
}

.phone-input-container input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex: 1;
}

.dialer-actions {
    display: flex;
    gap: 12px;
}

.btn-call-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.btn-call-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -10px rgba(0,0,0,0.3);
}

.btn-call-main:active {
    transform: translateY(0);
}

.btn-hangup-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.btn-hangup-main:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.btn-icon {
    width: 22px;
    height: 22px;
}

/* Call Status Box */
.call-status-box {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.call-status-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.call-status-animation {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    animation: pulse-ring 1.5s ease-out infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.call-status-icon {
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-status-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.call-status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-status-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.call-status-details {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

.call-status-box.connected .call-status-icon {
    background: var(--success);
}

.call-status-box.connected .call-status-icon svg {
    color: #fff;
}

.call-status-box.ended {
    background: rgba(255,255,255,0.1);
}

.call-status-box.ended .pulse-ring {
    display: none;
}

.call-status-box.error {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.call-status-box.error .call-status-icon {
    background: var(--danger);
}

.call-status-box.error .call-status-icon svg {
    color: #fff;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.card-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* =====================================================
   FILTERS
   ===================================================== */
.filters-card {
    border-left: 4px solid var(--primary);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--card-bg);
    transition: var(--transition-fast);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-actions {
    display: flex;
    gap: 8px;
    flex-direction: row;
    margin-left: auto;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--text-secondary);
}

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

.btn-icon-sm {
    width: 16px;
    height: 16px;
}

/* =====================================================
   TABLE
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 14px 16px;
    text-align: left;
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

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

tr:hover td {
    background: var(--bg);
}

tr {
    cursor: pointer;
    transition: var(--transition-fast);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-unknown {
    background: var(--border-light);
    color: var(--text-secondary);
}

.status-ongoing {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: var(--success-light);
    color: #065f46;
}

.status-failed {
    background: var(--danger-light);
    color: #991b1b;
}

.status-missed {
    background: var(--warning-light);
    color: #92400e;
}

/* Direction Badges */
.direction-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.direction-inbound {
    background: #e0f2fe;
    color: #0369a1;
}

.direction-outbound {
    background: #f3e8ff;
    color: #7c3aed;
}

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

/* =====================================================
   LOADING & STATES
   ===================================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

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

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

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.error-message {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 16px;
    border-radius: var(--radius-sm);
}

/* =====================================================
   DETAIL PAGE
   ===================================================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--primary);
}

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

.detail-item {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.summary-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.summary-box h3 {
    color: var(--primary-hover);
    font-size: 16px;
    margin-bottom: 12px;
}

.summary-text {
    color: var(--text);
    line-height: 1.7;
}

.recording-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #fdf4ff 0%, #f5d0fe 100%);
    border: 1px solid #e879f9;
    border-radius: var(--radius-sm);
    color: #a21caf;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 20px;
}

.recording-link:hover {
    background: linear-gradient(135deg, #fae8ff 0%, #f0abfc 100%);
    transform: translateY(-2px);
}

/* Transcript */
.transcript {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.turn {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
}

.turn-user {
    background: #f0fdf4;
    border-left: 3px solid var(--success);
}

.turn-assistant {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.turn-system {
    background: var(--warning-light);
    border-left: 3px solid var(--warning);
}

.turn-role {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    min-width: 80px;
}

.turn-user .turn-role { color: var(--success); }
.turn-assistant .turn-role { color: var(--primary); }
.turn-system .turn-role { color: var(--warning); }

.turn-text {
    flex: 1;
    color: var(--text);
}

.turn-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .dialer-card {
        padding: 20px;
    }

    .dialer-inputs {
        grid-template-columns: 1fr;
    }

    .dialer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-actions {
        margin-left: 0;
        width: 100%;
    }

    .filter-actions .btn {
        flex: 1;
    }

    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .header-subtitle {
        margin-left: 0;
    }

    .pagination {
        flex-direction: column;
        gap: 12px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
