* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f5f5f5;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari için */
    color: #333;
    overflow-x: hidden;
    /* Safe area desteği (iPhone X ve üzeri) */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari için */
    /* Safe area desteği */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.5s ease;
    border: 1px solid #e5e5e5;
    /* Mobil için daha iyi görünüm */
    margin: 0 auto;
    position: relative;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo h1 {
    font-size: 3rem;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-weight: 700;
    letter-spacing: -1px;
}

.tagline {
    color: #666;
    font-size: 1rem;
    margin-bottom: 40px;
    font-weight: 400;
}

.login-form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fafafa;
    /* Mobil için optimize */
    -webkit-appearance: none;
    appearance: none;
    /* iOS zoom'u önle */
    font-size: 16px;
    /* Touch için daha iyi */
    min-height: 44px; /* Apple'ın önerdiği minimum touch target */
}

.form-group input:focus {
    outline: none;
    border-color: #4a4a4a;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-group input::placeholder {
    color: #999;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Touch için optimize */
    min-height: 48px; /* Apple'ın önerdiği minimum touch target */
    -webkit-tap-highlight-color: transparent; /* Mobil tıklama efekti */
    touch-action: manipulation; /* Double-tap zoom'u önle */
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #1a1a1a;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2a2a2a;
}

.btn-primary:active:not(:disabled) {
    background: #1a1a1a;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    margin-top: 24px;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.info-text {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
}

.info-text p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Bekleme Ekranı */
#waitingScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    z-index: 100;
    overflow-y: auto;
}

#waitingScreen.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.waiting-card {
    padding: 60px 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    animation: fadeInUp 0.5s ease;
    border: 1px solid #e5e5e5;
}

.loading-container {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e5e5;
    border-top: 4px solid #1a1a1a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-container h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #333;
    font-weight: 600;
    display: block;
}

.loading-container p {
    color: #666;
    font-size: 1rem;
    margin-bottom: 24px;
    display: block;
    line-height: 1.5;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    width: 100%;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Toast Mesajları */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2a2a2a;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1000;
    max-width: 350px;
    animation: slideIn 0.3s ease-out;
}

.toast.show {
    display: block;
}

.toast.error {
    background: #d32f2f;
}

.toast.success {
    background: #388e3c;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Tasarım */

/* Tablet ve küçük ekranlar */
@media (max-width: 768px) {
    .container {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .card {
        padding: 40px 32px;
        border-radius: 14px;
    }

    .logo h1 {
        font-size: 2.5rem;
        margin-bottom: 6px;
    }

    .tagline {
        font-size: 0.95rem;
        margin-bottom: 32px;
    }

    .login-form {
        margin-top: 28px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* iOS zoom'u önlemek için */
    }

    .btn {
        padding: 15px;
        font-size: 1rem;
        min-height: 48px;
    }

    .waiting-card {
        padding: 50px 32px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .loading-container h2 {
        font-size: 1.3rem;
    }
    
    .loading-container p {
        font-size: 0.9rem;
    }
}

/* Küçük mobil cihazlar */
@media (max-width: 480px) {
    .container {
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .card {
        padding: 32px 20px;
        border-radius: 12px;
    }

    .logo h1 {
        font-size: 2rem;
        margin-bottom: 4px;
        letter-spacing: -0.5px;
    }

    .tagline {
        font-size: 0.9rem;
        margin-bottom: 28px;
        line-height: 1.4;
    }

    .login-form {
        margin-top: 24px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* iOS zoom'u önlemek için */
        border-radius: 10px;
    }

    .btn {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 10px;
    }

    .toast {
        right: 12px;
        left: 12px;
        max-width: none;
        top: max(12px, env(safe-area-inset-top));
        padding: 14px 20px;
        font-size: 0.9rem;
    }
    
    .waiting-card {
        padding: 36px 20px;
    }
    
    .loading-spinner {
        width: 45px;
        height: 45px;
        border-width: 3px;
        margin-bottom: 20px;
    }
    
    .loading-container h2 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .loading-container p {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .loading-dots span {
        width: 8px;
        height: 8px;
    }
}

/* Çok küçük ekranlar (iPhone SE gibi) */
@media (max-width: 375px) {
    .container {
        padding: 10px;
    }

    .card {
        padding: 28px 16px;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 0.85rem;
        margin-bottom: 24px;
    }

    .form-group input {
        padding: 12px 14px;
    }

    .btn {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
}

/* Landscape mod (yatay) */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 10px;
        min-height: auto;
        align-items: flex-start;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .card {
        padding: 24px 32px;
        margin-top: 10px;
    }

    .logo h1 {
        font-size: 1.75rem;
        margin-bottom: 4px;
    }

    .tagline {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    .login-form {
        margin-top: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group input {
        padding: 12px 16px;
    }

    .btn {
        padding: 12px;
        min-height: 44px;
    }
}

/* Yüksek DPI ekranlar için */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }
}

/* Touch cihazlar için */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        /* Touch cihazlarda hover efekti yok */
    }

    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    .form-group input:focus {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
    }
}
