/* ServTak v9 - Temiz ve Sade */

:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16162a;
    --text: #ffffff;
    --text-dim: #9090b0;
    --accent: #6366f1;
    --green: #22c55e;
    --orange: #f97316;
    --red: #ef4444;
    --blue: #3b82f6;
    --purple: #a855f7;
    --gray: #6b7280;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ==================== AUTH ==================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 28px;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header .logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1.8rem;
}

.auth-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-header p { color: var(--text-dim); font-size: 0.9rem; }

.user-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.user-type-btn {
    flex: 1;
    padding: 12px 8px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.user-type-btn i { font-size: 1.1rem; }
.user-type-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.auth-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 0.8rem; color: var(--text-dim); }

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input:focus { outline: none; border-color: var(--accent); }
.form-group input::placeholder { color: var(--gray); }

.form-note {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 20px;
}

/* ==================== BUTTONS ==================== */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-block { width: 100%; margin-top: 8px; }

.btn-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    color: var(--text-dim);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
}

/* ==================== HEADER ==================== */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

.header-left i { color: var(--accent); }
.header-right { display: flex; gap: 8px; }

/* ==================== PANEL ==================== */

.panel {
    max-width: 500px;
    margin: 0 auto;
    padding: 16px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0 10px;
    padding: 0 4px;
}

.section-title span { font-weight: 600; font-size: 0.95rem; }
.section-title small { color: var(--text-dim); font-size: 0.75rem; }

/* ==================== ŞOFÖR PANELİ ==================== */

.driver-info-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.driver-info-card .info-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.driver-info-card .company {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.driver-info-card .driver {
    font-weight: 600;
    font-size: 1.1rem;
}

.service-code {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--accent);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

/* ==================== ÖĞRENCİ LİSTESİ ==================== */

.student-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.student-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    border-left: 4px solid var(--gray);
}

.student-card.calling { 
    border-left-color: var(--blue); 
    background: rgba(59, 130, 246, 0.1); 
    animation: border-blink 0.6s ease-in-out infinite;
}

@keyframes border-blink {
    0%, 100% { 
        border-color: var(--blue);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
    50% { 
        border-color: #60a5fa;
        box-shadow: 0 0 15px 2px rgba(59, 130, 246, 0.5);
    }
}
.student-card.waiting { border-left-color: var(--green); }
.student-card.preparing { border-left-color: var(--orange); }
.student-card.hold { border-left-color: var(--purple); }
.student-card.not_coming { border-left-color: var(--red); }
.student-card.boarded { border-left-color: var(--green); background: rgba(34, 197, 94, 0.1); }

.student-order {
    width: 28px;
    height: 28px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.student-name {
    flex: 1;
    font-weight: 500;
}

.student-status {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    color: white;
}

.student-status.pending { background: var(--gray); }
.student-status.calling { background: var(--blue); animation: blink 0.5s ease-in-out infinite; }
.student-status.waiting { background: var(--green); }
.student-status.preparing { background: var(--orange); }
.student-status.hold { background: var(--purple); }
.student-status.not_coming { background: var(--red); }
.student-status.boarded { background: var(--green); }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.student-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.5;
    padding: 4px;
}

.student-delete:hover { opacity: 1; color: var(--red); }

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

.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { margin-bottom: 12px; }

.empty-state .code {
    display: inline-block;
    padding: 12px 20px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
}

/* ==================== ÖĞRENCİ/VELİ PANELİ ==================== */

.welcome-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
}

.welcome-text span {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.welcome-text strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 2px;
}

.service-info {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.service-info i {
    color: var(--accent);
    margin-right: 4px;
}

/* ==================== DURUM KARTI ==================== */

.status-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin: 16px 0;
    border: 2px solid transparent;
}

.status-card.pending { border-color: var(--gray); }
.status-card.calling { border-color: var(--blue); background: rgba(59, 130, 246, 0.1); }
.status-card.waiting { border-color: var(--green); }
.status-card.preparing { border-color: var(--orange); }
.status-card.hold { border-color: var(--purple); }
.status-card.not_coming { border-color: var(--red); }
.status-card.boarded { border-color: var(--green); background: rgba(34, 197, 94, 0.1); }

.status-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.status-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.status-card.waiting .status-value { color: var(--green); }
.status-card.preparing .status-value { color: var(--orange); }
.status-card.hold .status-value { color: var(--purple); }
.status-card.not_coming .status-value { color: var(--red); }
.status-card.boarded .status-value { color: var(--green); }

.status-position {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* ==================== ÇAĞRI ALARMI ==================== */

.call-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-alert-inner {
    text-align: center;
    padding: 30px 20px;
    width: 100%;
    max-width: 340px;
}

.call-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
}

.call-icon.pulsing {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
}

.call-alert h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.call-alert h2.blink-text {
    animation: text-blink 0.6s ease-in-out infinite;
}

@keyframes text-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.call-alert p {
    color: var(--text-dim);
    margin-bottom: 30px;
}

.response-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.response-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    color: white;
}

.response-btn.green { background: var(--green); }
.response-btn.orange { background: var(--orange); }
.response-btn.purple { background: var(--purple); }
.response-btn.red { background: var(--red); }

.response-btn:active { transform: scale(0.98); }

/* ==================== SIRA LİSTESİ ==================== */

.queue-list {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-left: 3px solid var(--gray);
}

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

.queue-item.is-me {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--accent);
}

.queue-item.calling { border-left-color: var(--blue); background: rgba(59, 130, 246, 0.1); }
.queue-item.waiting { border-left-color: var(--green); }
.queue-item.preparing { border-left-color: var(--orange); }
.queue-item.hold { border-left-color: var(--purple); }
.queue-item.not_coming { border-left-color: var(--red); }
.queue-item.boarded { border-left-color: var(--green); }

.queue-order {
    width: 24px;
    height: 24px;
    background: var(--bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.queue-name { flex: 1; font-size: 0.9rem; }

.queue-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    color: white;
}

.queue-status.pending { background: rgba(107, 114, 128, 0.3); color: var(--gray); }
.queue-status.calling { background: var(--blue); }
.queue-status.waiting { background: var(--green); }
.queue-status.preparing { background: var(--orange); }
.queue-status.hold { background: var(--purple); }
.queue-status.not_coming { background: var(--red); }
.queue-status.boarded { background: var(--green); }

.queue-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-dim);
}

/* ==================== VELİ UYARISI ==================== */

.parent-alert {
    background: var(--blue);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.parent-alert i { font-size: 1.2rem; }
.parent-alert span { flex: 1; }
.parent-alert button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
}

/* ==================== ADMİN PANELİ ==================== */

.admin-header {
    text-align: center;
    padding: 16px;
}

.admin-header h2 {
    font-size: 1.2rem;
}

.admin-header h2 i {
    color: var(--purple);
    margin-right: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
}

.stat-card i {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.stat-card.blue i { color: var(--blue); }
.stat-card.green i { color: var(--green); }
.stat-card.orange i { color: var(--orange); }
.stat-card.purple i { color: var(--purple); }

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-tab {
    flex: 1;
    padding: 10px;
    background: var(--bg-card);
    border: none;
    border-radius: 10px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
}

.admin-tab.active {
    background: var(--accent);
    color: white;
}

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.admin-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-card-info strong { display: block; }
.admin-card-info span { font-size: 0.8rem; color: var(--text-dim); }

.admin-card-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

/* ==================== MODAL ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.modal-body {
    padding: 16px;
}

.modal-body.center {
    text-align: center;
}

.modal-body h4 {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.modal-body p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 12px;
}

.code-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 3px;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
}

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

#toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    margin-top: 8px;
    font-size: 0.9rem;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--green); }
.toast.success i { color: var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.error i { color: var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.info i { color: var(--blue); }

/* ==================== LOADING ==================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .user-type-btn { padding: 10px 6px; }
}
