:root {
    --bg-color: #0f172a;
    /* Slate 900 */
    --panel-bg: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --primary-color: #3b82f6;
    /* Blue 500 */
    --primary-hover: #2563eb;
    /* Blue 600 */
    --danger-color: #ef4444;
    /* Red 500 */
    --danger-hover: #dc2626;
    /* Red 600 */
    --warning-color: #f59e0b;
    /* Amber 500 */
    --warning-hover: #d97706;
    /* Amber 600 */
    --success-color: #10b981;
    /* Emerald 500 */
    --success-hover: #059669;
    /* Emerald 600 */

    --row-hover: rgba(51, 65, 85, 0.5);
    /* Slate 700 */
    --row-basarili: rgba(16, 185, 129, 0.25);
    --row-basarisiz: rgba(239, 68, 68, 0.25);
    --row-belirsiz: rgba(245, 158, 11, 0.25);
    /* Amber 500 (Yellow) */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.15), transparent 25%);
    background-attachment: fixed;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Typography & General */
h1,
h2,
h3 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #fff;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Login Page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header p {
    color: var(--text-secondary);
}

.alert {
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: var(--warning-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-block {
    display: block;
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
}

/* Panel Layout */
.panel-body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agent-copy-locked,
.agent-copy-locked *:not(input):not(textarea) {
    -webkit-user-select: none;
    user-select: none;
}

.agent-copy-locked {
    -webkit-touch-callout: none;
}

.top-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 1rem;
    margin: 0.4rem 0.5rem;
    flex-shrink: 0;
}

.top-bar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-left {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.assign-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.assign-select {
    height: 38px;
    min-width: 150px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-primary);
    padding: 0 0.65rem;
    font: inherit;
}

.top-bar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.agent-scope-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 34px;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-scope-title {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.agent-scope-tabs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.agent-scope-tab {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.34rem 0.8rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.agent-scope-tab:hover {
    border-color: rgba(59, 130, 246, 0.65);
    color: var(--text-primary);
}

.agent-scope-tab.active {
    background: rgba(59, 130, 246, 0.22);
    border-color: var(--primary-color);
    color: #bfdbfe;
}

.agent-scope-active {
    margin-left: auto;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
}

.pool-control-bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pool-agent-checks {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pool-agent-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 34px;
    padding: 0.3rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
}

.pool-agent-check input {
    accent-color: var(--primary-color);
}

.pool-agent-check.locked {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: rgba(239, 68, 68, 0.25);
}

.pool-agent-check.locked input {
    cursor: not-allowed;
}

.user-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    margin-right: 1rem;
    font-size: 0.9rem;
}

.agent-mini-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.32rem 0.65rem;
    border-radius: 999px;
    margin-right: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #dbeafe;
}

.agent-design-test .top-bar {
    display: none;
}

.agent-design-test .top-bar-main {
    justify-content: flex-end;
}

.agent-design-test .top-bar-left,
.agent-design-test .lang-switcher,
.agent-design-test .user-badge {
    display: none;
}

.agent-design-test .btn-outline {
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
}

.lang-switcher {
    margin-right: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.lang-switcher a,
.lang-switcher span {
    padding: 0.2rem 0.4rem;
    transition: color 0.2s;
}

.lang-switcher a:hover {
    color: white;
}

.lang-switcher a.active,
.lang-switcher span.active {
    color: white;
    font-weight: bold;
    text-decoration: underline;
}

@media (max-width: 900px) {
    .top-bar-main,
    .agent-scope-bar,
    .pool-control-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .agent-scope-active {
        margin-left: 0;
    }
}

.main-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin: 0 0.5rem 0.5rem 0.5rem;
    gap: 0.4rem;
    overflow: hidden;
}

.table-container {
    height: var(--contact-table-height, 250px);
    min-height: 120px;
    flex: 0 0 auto;
    overflow: auto;
    border-radius: 12px;
}

.layout-resizer {
    position: relative;
    height: 12px;
    flex: 0 0 12px;
    cursor: row-resize;
    touch-action: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.layout-resizer::before {
    content: "";
    width: 100%;
    height: 1px;
    background: rgba(148, 163, 184, 0.35);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45);
}

.layout-resizer::after {
    content: "";
    position: absolute;
    width: 72px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    transition: background 0.15s ease, transform 0.15s ease;
}

.layout-resizer:hover::after,
.layout-resizer:focus-visible::after,
.layout-resizer.is-dragging::after {
    background: var(--primary-color);
    transform: scaleX(1.15);
}

body.layout-resizing {
    cursor: row-resize;
    user-select: none;
}

.map-container {
    flex: 1;
    min-height: 240px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-design-test .map-container {
    flex: 1 1 auto;
    min-height: 130px;
}

.agent-design-test .table-container {
    height: var(--contact-table-height, 175px);
    min-height: 95px;
    flex: 0 0 auto;
}

.agent-address-call {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    max-width: 100%;
}

.agent-address-call span {
    min-width: 0;
}

.agent-design-test thead {
    display: none;
}

.agent-design-test table {
    table-layout: auto;
    width: auto;
    min-width: 0;
}

.agent-design-test tbody td:nth-child(1) {
    width: 64px;
}

.agent-design-test tbody td:nth-child(2) {
    width: 330px;
}

.agent-design-test tbody td:nth-child(3) {
    width: 190px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.agent-design-test tbody td:nth-child(4) {
    width: auto;
}

.agent-design-test tbody td {
    padding: 0.14rem 0.55rem;
    line-height: 1.15;
    white-space: nowrap;
}

.agent-design-test tbody tr {
    height: 34px;
}

.agent-design-test .action-group {
    gap: 2px;
}

.agent-design-test .btn-icon {
    width: 18px;
    height: 18px;
    font-size: 0.72rem;
}

.agent-design-test .call-btn {
    padding: 0.22rem 0.5rem;
    font-size: 0.72rem;
    line-height: 1;
    flex: 0 0 auto;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

#map-placeholder {
    color: var(--text-secondary);
    font-size: 1.1rem;
    position: absolute;
    pointer-events: none;
}

/* Table Design */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    table-layout: fixed;
}

thead th {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    padding: 0.7rem 0.8rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

tbody td {
    padding: 0.28rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    font-size: 0.9rem;
    word-break: break-word;
    white-space: normal;
}

tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

tbody tr:hover {
    background: var(--row-hover) !important;
}

/* Status Row Colors */
tbody tr.status-basarili {
    background-color: var(--row-basarili) !important;
}

tbody tr.status-basarisiz {
    background-color: var(--row-basarisiz) !important;
}

tbody tr.status-belirsiz {
    background-color: var(--row-belirsiz) !important;
}

tbody tr.status-bosta {
    background-color: transparent !important;
}

/* Dim unselected buttons */
tbody tr.status-basarili .action-danger,
tbody tr.status-basarili .action-warning,
tbody tr.status-basarili .action-secondary {
    opacity: 0.3;
    filter: grayscale(100%);
}

tbody tr.status-basarisiz .action-success,
tbody tr.status-basarisiz .action-warning,
tbody tr.status-basarisiz .action-secondary {
    opacity: 0.3;
    filter: grayscale(100%);
}

tbody tr.status-belirsiz .action-success,
tbody tr.status-belirsiz .action-danger,
tbody tr.status-belirsiz .action-secondary {
    opacity: 0.3;
    filter: grayscale(100%);
}

tbody tr.status-bosta .action-success,
tbody tr.status-bosta .action-danger,
tbody tr.status-bosta .action-warning {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Only restore opacity on actual button hover, not row hover */
tbody tr .btn-icon:hover {
    opacity: 1 !important;
    filter: grayscale(0%) !important;
}

/* Action Buttons in Table */
.action-group {
    display: flex;
    gap: 2px;
}

.btn-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 10px;
    font-weight: bold;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.action-success {
    background: var(--success-color);
    color: white;
}

.action-danger {
    background: var(--danger-color);
    color: white;
}

.action-warning {
    background: var(--warning-color);
    color: white;
}

.call-btn {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.call-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-color);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    border: 1px solid var(--panel-border);
}

.close-btn {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.inline-note-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.inline-note-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.6);
}

.inline-note-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    width: 120%;
    /* Expand slightly when focused */
    position: relative;
    z-index: 20;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
