﻿/* ═══════════════════════════════════════════════════════════════════
   SADAKATIM MOBILE TEMPLATE — APP-LIKE FULLSCREEN
   Mobil: scroll yok, tam ekran, app davranışı
   Desktop: ortalı kart görünümü
   ═══════════════════════════════════════════════════════════════════ */

/* ─── RESET ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    height: 100%;
    overflow: hidden;
}

/* ─── BODY: Mobilde scroll yok, app gibi ─── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.4;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* ─── PAGE CONTAINER ─── */
.page-container {
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

/* ─── MAIN CARD ─── */
.main-card {
    width: 100%;
    max-width: 440px;
    height: 100%;
    background: white;
    border: none;
    box-shadow: none;
    border-radius: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: clamp(10px, 2vh, 22px) clamp(16px, 5vw, 28px);
    gap: clamp(4px, 1.2vh, 12px);
}

    .main-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #00a8e8 0%, #00d4ff 100%);
        display: none;
    }

    .main-card::-webkit-scrollbar {
        display: none;
    }

/* ─── HEADER ─── */
.header-section {
    flex-shrink: 0;
    text-align: center;
}

.company-logos-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 2vw, 12px);
    margin-bottom: clamp(2px, 0.8vh, 6px);
    flex-wrap: nowrap;
}

.company-logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    padding: clamp(2px, 0.8vh, 6px);
    flex-shrink: 1;
}

    /* ═══════════ LOGO BOYUTLARI - SABIT, DETERMINISTIC ═══════════ */
    /* DEFAULT (360-419px telefonlar - iPhone 14/15 normal) */
    .company-logo-wrapper.single {
        width: 165px;
        height: 54px;
    }

    .company-logo-wrapper.dual {
        width: 84px;
        height: 84px;
    }

    .company-logo-wrapper img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        display: block;
    }

.company-logo-fallback {
    font-size: clamp(16px, 4vw, 24px);
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    line-height: 1;
}

.page-title {
    font-size: clamp(16px, 2.5vh, 22px);
    font-weight: 700;
    color: #1a1a1a;
    margin-top: clamp(2px, 0.8vh, 6px);
    margin-bottom: 0;
}

/* ─── LOCATION STATUS (KIRPILDI: tek satır, kompakt) ─── */
.location-status {
    display: none;
    flex-shrink: 0;
    text-align: center;
    font-size: 10px;
    color: #6b7280;
    padding: 3px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    line-height: 1.2;
    /* Tek satıra sıkıştır - taşan kısmı ... ile kes */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .location-status.show {
        display: block;
    }

    .location-status.success {
        color: #10b981;
        background: #d1fae5;
    }

    .location-status.error {
        color: #ef4444;
        background: #fee2e2;
    }

/* ─── QR SCANNER ─── */
.qr-scanner-container {
    flex-shrink: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-video-wrapper {
    position: relative;
    width: min(28vh, 50vw, 190px);
    max-width: 100%;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    border: 3px dashed #00a8e8;
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.2);
    aspect-ratio: 1 / 1;
    background: #f3f4f6;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@supports not (aspect-ratio: 1 / 1) {
    .qr-video-wrapper::before {
        content: '';
        display: block;
        padding-top: 100%;
    }
}

.qr-video-wrapper.qr-scanned {
    border-color: #10b981;
    border-style: solid;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }
}

#qrVideo {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border: 0;
    outline: 0;
    background: transparent;
}

.qr-success-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(16, 185, 129, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

    .qr-success-overlay.show {
        display: flex;
        animation: fadeInOut 0.6s ease;
    }

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

.qr-success-icon {
    width: clamp(40px, 8vh, 60px);
    height: clamp(40px, 8vh, 60px);
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

    .qr-success-icon svg {
        width: 60%;
        height: 60%;
        stroke: #10b981;
        stroke-width: 3;
    }

.qr-help {
    display: none;
    text-align: center;
    font-size: clamp(10px, 1.3vh, 12px);
    margin-top: clamp(4px, 0.8vh, 8px);
    color: #6b7280;
    line-height: 1.3;
    padding: 0 clamp(8px, 3vw, 16px);
}

    .qr-help.is-warn {
        color: #f59e0b;
    }

    .qr-help.is-error {
        color: #ef4444;
    }

    .qr-help.is-success {
        color: #10b981;
        font-weight: 600;
    }

/* ─── FORM ─── */
form {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vh, 10px);
}

.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: clamp(11px, 1.4vh, 13px);
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: clamp(2px, 0.5vh, 5px);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: clamp(12px, 3.5vw, 16px);
    color: #9ca3af;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

    .input-icon svg {
        width: clamp(16px, 4vw, 20px);
        height: clamp(16px, 4vw, 20px);
        stroke: currentColor;
    }

.form-input {
    width: 100%;
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 3.5vw, 14px) clamp(8px, 1.5vh, 12px) clamp(38px, 10vw, 44px);
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    background: white;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

    .form-input:focus {
        border-color: #00a8e8;
        box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.1);
    }

    .form-input::placeholder {
        color: #9ca3af;
        opacity: 1;
    }

    .form-input:read-only {
        background: #f9fafb;
        cursor: not-allowed;
    }

.form-hint {
    font-size: clamp(10px, 1.2vh, 12px);
    color: #6b7280;
    margin-top: clamp(2px, 0.5vh, 5px);
    line-height: 1.3;
}

/* ─── BUTTONS ─── */
.btn {
    width: 100%;
    padding: clamp(9px, 1.6vh, 13px) clamp(16px, 5vw, 20px);
    border: none;
    border-radius: 10px;
    font-size: clamp(12px, 1.7vh, 15px);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    outline: none;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00a8e8 0%, #0090c8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

    .btn-primary:active:not(:disabled) {
        transform: scale(0.98);
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        box-shadow: none;
    }

.btn-secondary {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(6px, 2vw, 8px);
}

.btn-link {
    background: transparent;
    color: #00a8e8;
    border: none;
    text-decoration: underline;
    padding: clamp(4px, 0.8vh, 8px);
    font-size: clamp(11px, 1.4vh, 13px);
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ─── ALERTS ─── */
.alert {
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 4vw, 16px);
    border-radius: 10px;
    text-align: center;
    font-size: clamp(12px, 1.5vh, 14px);
    font-weight: 500;
    line-height: 1.3;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ─── SLOGAN ─── */
.company-slogan {
    text-align: center;
    font-size: clamp(11px, 1.4vh, 13px);
    color: #64748b;
    font-style: italic;
    margin: clamp(2px, 0.6vh, 6px) 0;
    padding: 0 clamp(8px, 3vw, 16px);
    line-height: 1.3;
    flex-shrink: 0;
}

/* ─── FOOTER ─── */
.footer-text {
    flex-shrink: 0;
    margin-top: auto;
    text-align: center;
    font-size: clamp(9px, 1.1vh, 10px);
    color: #9ca3af;
    line-height: 1.3;
    padding-top: clamp(4px, 0.8vh, 8px);
}

    .footer-text.footer-brand {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: clamp(6px, 2vw, 12px);
        flex-wrap: nowrap;
    }

.footer-logo {
    width: clamp(60px, 18vw, 90px);
    height: auto;
    opacity: 0.92;
    flex-shrink: 0;
}

.footer-copy {
    text-align: right;
    font-size: clamp(9px, 1.1vh, 10px);
    color: #9ca3af;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

    .footer-copy a {
        transition: color 0.2s ease;
    }

/* ═══════════════════════════════════════════════════════════════════
   MODAL'LAR
   ═══════════════════════════════════════════════════════════════════ */
.modal-backdropx {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    padding: clamp(8px, 3vw, 18px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

    .modal-backdropx.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.auth-modal {
    width: 100%;
    max-width: clamp(320px, 90vw, 520px);
    background: #fff;
    border-radius: clamp(12px, 3vw, 16px);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(12px, 3.5vw, 16px);
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.auth-modal__title {
    font-size: clamp(14px, 4vw, 16px);
    font-weight: 800;
    color: #111827;
    letter-spacing: 0.2px;
}

.auth-modal__close {
    border: 0;
    background: transparent;
    width: clamp(32px, 9vw, 36px);
    height: clamp(32px, 9vw, 36px);
    border-radius: 10px;
    font-size: clamp(20px, 5vw, 22px);
    color: #9ca3af;
    cursor: pointer;
    display: grid;
    place-items: center;
    -webkit-tap-highlight-color: transparent;
}

    .auth-modal__close:hover {
        background: #f3f4f6;
        color: #111827;
    }

.auth-modal__body {
    padding: clamp(12px, 4vw, 18px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vh, 14px);
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 3vw, 12px);
}

@media (max-width: 480px) {
    .auth-grid {
        grid-template-columns: 1fr;
    }
}

.auth-grid .form-group {
    margin-bottom: 0;
}

.auth-actions {
    display: grid;
    gap: clamp(8px, 2vw, 10px);
    margin-top: clamp(8px, 2vh, 14px);
}

.auth-error,
.auth-success {
    display: none;
    padding: clamp(8px, 2vh, 12px);
    border-radius: 10px;
    font-size: clamp(12px, 1.6vh, 13px);
    line-height: 1.4;
}

    .auth-error.show {
        display: block;
        background: #fee2e2;
        border: 1px solid #fca5a5;
        color: #991b1b;
    }

    .auth-success.show {
        display: block;
        background: #d1fae5;
        border: 1px solid #6ee7b7;
        color: #065f46;
    }

.auth-modal__body::-webkit-scrollbar {
    width: 4px;
}

.auth-modal__body::-webkit-scrollbar-track {
    background: transparent;
}

.auth-modal__body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* ─── SELECT INPUT ─── */
.form-select-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: #fff;
    background-image: none;
    padding-right: 44px;
}

.select-wrapper::after {
    content: "";
    position: absolute;
    right: clamp(12px, 4vw, 16px);
    top: 50%;
    transform: translateY(-65%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid #9ca3af;
    border-bottom: 2px solid #9ca3af;
    pointer-events: none;
}

.form-select-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
}

/* ═══════════════════════════════════════════════════════════════════
   GENİŞ TELEFONLAR (iPhone Pro Max sınıfı - 420px+)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 420px) {
    .company-logo-wrapper.single {
        width: 185px;
        height: 60px;
    }

    .company-logo-wrapper.dual {
        width: 96px;
        height: 96px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   ÇOK KÜÇÜK CİHAZLAR (iPhone SE, eski Android)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-height: 700px) and (orientation: portrait) {
    .main-card {
        padding: clamp(8px, 1.5vh, 14px) clamp(12px, 4vw, 20px);
        gap: clamp(2px, 0.8vh, 6px);
    }

    .qr-video-wrapper {
        width: min(22vh, 42vw, 150px);
    }

    .company-logo-wrapper.single {
        width: 140px;
        height: 44px;
    }

    .company-logo-wrapper.dual {
        width: 74px;
        height: 74px;
    }

    .page-title {
        font-size: clamp(14px, 2vh, 18px);
    }

    .form-input {
        padding: clamp(7px, 1.2vh, 10px) 14px clamp(7px, 1.2vh, 10px) 38px;
    }

    .btn {
        padding: clamp(8px, 1.4vh, 11px) 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   YATAY MOD (LANDSCAPE)
   ═══════════════════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 500px) {
    .qr-video-wrapper {
        width: min(50vh, 30vw, 150px);
    }

    .company-logo-wrapper.single {
        width: 140px;
        height: 42px;
    }

    .page-title {
        font-size: clamp(14px, 4vh, 18px);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   DESKTOP / TABLET (768px+)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    body {
        background: #f5f5f5;
    }

    .page-container {
        align-items: center;
        padding: clamp(16px, 3vh, 32px);
    }

    .main-card {
        height: auto;
        max-height: calc(100vh - 64px);
        max-height: calc(100dvh - 64px);
        border-radius: 24px;
        border: 1px solid #e5e7eb;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
        padding: 28px 32px;
        gap: 12px;
    }

        .main-card::before {
            display: block;
            border-radius: 24px 24px 0 0;
        }

    .qr-video-wrapper {
        width: min(220px, 50vw);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   SAFARI-ONLY HARDENING (iOS)
   ═══════════════════════════════════════════════════════════════════ */
@supports (-webkit-touch-callout: none) {
    body,
    .page-container {
        height: -webkit-fill-available;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}
