/* --- Google Fonts ve İkonlar --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Poppins:wght@400;500;600;700&display=swap');

/* --- CSS Değişkenleri (Renk Paleti) --- */
:root {
    --primary-color: #007bff; /* Ana Mavi */
    --primary-dark: #0056b3;
    --background-color: #f0f2f5; /* Hafif Gri Arka Plan */
    --card-bg-color: #ffffff;
    --text-color: #333333;
    --text-light: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-color: #dee2e6;
    --app-topbar-offset: 88px;
}

/* --- Genel Sıfırlama ve Body Stili --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--background-color);
}

body {
    font-family: 'DM Sans', 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: auto;
    height: auto;
}

/* --- Ana Konteyner --- */
.container {
    padding: 10px 12px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    overflow-x: hidden;
}

body:has(.app-topbar) > .container {
    padding-top: var(--app-topbar-offset);
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

/* --- Şirket Logosu --- */
.company-logo {
    display: block;
    max-width: 180px; /* Logo boyutunu ayarlayın */
    height: auto;
    margin: 0px auto 0px auto;
}

/* --- Kart Yapısı --- */
.card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

/* --- Form Elemanları --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* --- Butonlar --- */
.btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}


/* --- Hata Mesajı --- */
.error-message {
    background-color: #f8d7da;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
    border: 1px solid #f5c6cb;
}

/* --- Standart üst bar (tüm sayfalar) --- */
.app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    min-height: 68px;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

body:has(.app-topbar) {
    padding: 0;
}

/* İçerik sayfaları: kısa içerikte altta gri boşluk kalmasın */
body:has(.app-topbar):not(.app-dashboard):not(.home-body):not(.login-body):not(:has(.app-footer-logout)) {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}

body:has(.app-topbar):not(.app-dashboard):not(:has(.app-footer-logout)) > .container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body:has(.app-topbar):not(.app-dashboard) > .container > *:only-child {
    flex: 1 0 auto;
    background: var(--card-bg-color);
    border-radius: 16px;
}

.app-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.app-topbar-logo-link {
    display: block;
    flex-shrink: 0;
    text-decoration: none;
}

.app-topbar-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    padding: 4px;
    display: block;
}

.app-topbar-greeting {
    min-width: 0;
}

.app-topbar-greeting p {
    font-size: 0.92rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.2;
}

.app-topbar-greeting h1 {
    font-size: 1.28rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.app-topbar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    z-index: 110;
}

.app-topbar-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-topbar-plant {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    line-height: 1.2;
    max-width: 140px;
    text-align: right;
}

/* --- Mobil Uygulama Başlığı (eski app-header — geri uyumluluk) --- */
.app-header {
    background-color: var(--card-bg-color);
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 56px;
}
body:has(.app-header):not(:has(.app-topbar)) {
    padding-top: 56px;
}
.app-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    text-align: center;
    line-height: 1.2;
}
.app-header .back-button {
    font-size: 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    width: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.app-header-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-shrink: 0;
    z-index: 110;
}

/* --- Ana Sayfa Özel Stilleri --- */
.dashboard-header {
    text-align: center;
    margin-bottom: 20px;
}
.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}
.dashboard-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 12px;
}

.action-card {
    background: #fff;
    border-radius: 18px;
    padding: 18px 12px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        0 8px 20px rgba(15, 23, 42, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: clamp(108px, 17vh, 128px);
    aspect-ratio: 1.2 / 1;
    position: relative;
    overflow: hidden;
}
.action-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.55), transparent 45%);
    pointer-events: none;
}
.action-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 4px 8px rgba(15, 23, 42, 0.06),
        0 14px 28px rgba(15, 23, 42, 0.1);
}
.action-card .icon {
    font-size: 1.28rem;
    margin-bottom: 0;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 123, 255, 0.1);
    position: relative;
    z-index: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.action-card .icon.yemek {
    color: #0f766e;
    background: rgba(255, 255, 255, 0.88);
}
.action-card .icon.istek {
    color: #b45309;
    background: rgba(251, 191, 36, 0.2);
}
.action-card .icon.icon-purple {
    color: #6d28d9;
    background: rgba(139, 92, 246, 0.14);
}
.action-card .icon.icon-red {
    color: #be123c;
    background: rgba(244, 63, 94, 0.12);
}
.action-card .icon.icon-orange {
    color: #c2410c;
    background: rgba(251, 146, 60, 0.18);
}
.action-card .icon.icon-cyan {
    color: #0e7490;
    background: rgba(34, 211, 238, 0.16);
}
.action-card .icon.icon-blue {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.14);
}
.action-card .icon.icon-gray {
    color: #475569;
    background: rgba(148, 163, 184, 0.18);
}
.action-card p {
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.015em;
    position: relative;
    z-index: 1;
}

/* Diğer kartlara hafif ton */
.action-card-haftalik {
    background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: rgba(109, 40, 217, 0.1);
}
.action-card-japon {
    background: linear-gradient(160deg, #fff1f2 0%, #ffe4e6 100%);
    border-color: rgba(190, 18, 60, 0.1);
}
.action-card-degerlendir {
    background: linear-gradient(160deg, #fff7ed 0%, #ffedd5 100%);
    border-color: rgba(194, 65, 12, 0.1);
}
.action-card-anket {
    background: linear-gradient(160deg, #ecfeff 0%, #cffafe 100%);
    border-color: rgba(14, 116, 144, 0.1);
}
.action-card-vardiya {
    background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
    border-color: rgba(29, 78, 216, 0.1);
}
.action-card-istek {
    background: linear-gradient(160deg, #fffbeb 0%, #fef3c7 100%);
    border-color: rgba(180, 83, 9, 0.12);
}

/* --- Sabit Alt Menü / Footer (misafir çıkış) --- */
body:has(.app-footer-logout) {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* --- Ana Sayfa (Dashboard) Yeniden Tasarımı --- */

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-right: 15px;
    flex-shrink: 0; /* Küçülmesini engelle */
}

.greeting h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.greeting p {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0;
}

.info-card {
    padding: 20px;
}

.info-card .info-item {
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: var(--text-light);
}

.info-card .info-item:first-child {
    margin-bottom: 15px;
}

.info-card .info-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-right: 15px;
    width: 20px; /* İkonların hizalı durması için */
    text-align: center;
}

/* Çıkış Butonu için sabit footer */
.app-footer-logout {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: transparent;
    padding: 12px 20px max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

.app-footer-logout .btn {
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}


/*misafir sayfası için*/
/* Misafir butonu gibi ikincil eylemler için */
.btn-secondary {
    background-color: var(--text-light);
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* --- QR giriş bilgi ekranı (ana sayfa) --- */
.home-body {
    min-height: 100dvh;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top, rgba(0, 123, 255, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at bottom, rgba(0, 86, 179, 0.08) 0%, transparent 50%),
        linear-gradient(165deg, #eef4fc 0%, #f8fafc 45%, #eef2f7 100%);
}

.home-screen {
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
             max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    text-align: center;
}

.home-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg-color);
    border-radius: 20px;
    padding: 36px 28px 28px;
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 20px 48px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.home-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.home-qr-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 10px 28px rgba(0, 123, 255, 0.35);
    margin-bottom: 12px;
}

.home-brand-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin: 0;
}

.home-title {
    font-size: clamp(1.35rem, 4.5vw, 1.65rem);
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.35;
    margin: 0 0 12px;
}

.home-lead {
    font-size: 0.98rem;
    color: var(--text-light);
    line-height: 1.65;
    margin: 0 0 24px;
}

.home-lead strong {
    color: var(--text-color);
    font-weight: 600;
}

.home-steps {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    text-align: left;
}

.home-steps li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.92rem;
    color: var(--text-color);
    line-height: 1.5;
}

.home-steps li:first-child {
    border-top: none;
    padding-top: 0;
}

.home-step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    background: #f0f7ff;
    border: 1px solid #cfe2ff;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.86rem;
    color: #084298;
    line-height: 1.5;
}

.home-note i {
    margin-top: 2px;
    flex-shrink: 0;
    opacity: 0.85;
}

.home-footer {
    margin-top: 28px;
    font-size: 0.8rem;
    color: var(--text-light);
}

@media (orientation: landscape) and (max-height: 520px) {
    .home-screen {
        justify-content: flex-start;
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .home-card {
        padding: 24px 22px 20px;
    }

    .home-qr-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .home-brand {
        margin-bottom: 16px;
    }

    .home-title {
        margin-bottom: 8px;
    }

    .home-lead {
        margin-bottom: 16px;
    }

    .home-steps li {
        padding: 8px 0;
    }

    .home-footer {
        margin-top: 16px;
    }
}

@media (max-width: 480px) {
    body:has(.app-footer-logout) {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    .app-footer-logout {
        padding: 10px 16px max(10px, env(safe-area-inset-bottom, 0px));
    }

    /* Ana sayfa: kartlar ekranı doldursun */
    body.app-dashboard {
        min-height: 100svh;
        display: flex;
        flex-direction: column;
    }

    body.app-dashboard > .container {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    body.app-dashboard .action-grid {
        flex: 1 1 auto;
        min-height: 0;
        margin-top: 8px;
        margin-bottom: 0;
        grid-auto-rows: 1fr;
        align-content: stretch;
    }

    body.app-dashboard .action-card {
        min-height: 0;
        height: 100%;
        aspect-ratio: auto;
    }
}

@media (max-width: 360px) {
    .home-card {
        padding: 28px 20px 22px;
        border-radius: 16px;
    }
}

/* --- Login ekranı --- */
.login-body {
    min-height: 100dvh;
    min-height: 100vh;
    padding-bottom: 0;
    background:
        radial-gradient(ellipse at top right, rgba(0, 123, 255, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(0, 86, 179, 0.08) 0%, transparent 48%),
        linear-gradient(165deg, #eef4fc 0%, #f7f9fc 48%, #eef2f7 100%);
}

.login-screen {
    min-height: 100dvh;
    min-height: 100vh;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding:
        max(12px, env(safe-area-inset-top))
        max(20px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(20px, env(safe-area-inset-left));
    box-sizing: border-box;
}

.login-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.login-lang-plant {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.login-plant-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    line-height: 1.2;
    max-width: 160px;
    text-align: right;
}

.login-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 8px;
    min-height: 0;
}

.login-logo {
    display: block;
    max-width: min(360px, 90vw);
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto 12px;
}

.login-card {
    background: var(--card-bg-color);
    border-radius: 20px;
    padding: 28px 24px 24px;
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 18px 40px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form .form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #64748b;
    margin-bottom: 6px;
}

.login-form .form-control {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.login-submit {
    margin-top: 6px;
    border-radius: 12px;
    padding: 14px;
    font-size: 1.02rem;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.28);
}

.login-submit:hover {
    transform: translateY(-1px);
}

.login-alert {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 16px;
    text-align: center;
}

.login-guest {
    margin-top: 22px;
    text-align: center;
}

.login-guest-or {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.login-guest-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary-color);
    text-decoration: none;
}

.login-guest-link:hover {
    text-decoration: underline;
}

.login-copy {
    flex-shrink: 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: 20px;
    opacity: 0.85;
}

@media (max-height: 700px) {
    .login-logo {
        max-height: 160px;
        margin-bottom: 8px;
    }

    .login-card {
        padding: 22px 20px 20px;
        border-radius: 16px;
    }

    .login-form .form-group {
        margin-bottom: 12px;
    }

    .login-guest {
        margin-top: 16px;
    }

    .login-copy {
        margin-top: 12px;
    }
}

@media (max-height: 560px) {
    .login-main {
        padding-top: 4px;
    }

    .login-logo {
        max-height: 120px;
        margin-bottom: 6px;
    }
}