/* PWA Mobil Personel Takip - CSS */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --secondary-color: #FFC107;
    --success-color: #4CAF50;
    --error-color: #F44336;
    --warning-color: #FF9800;
    --text-primary: #212121;
    --text-secondary: #757575;
    --background: #FAFAFA;
    --surface: #FFFFFF;
    --border: #E0E0E0;
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* PWA Safe Areas */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--background);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: var(--transition);
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-content .logo {
    margin-bottom: 16px;
}

.splash-content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 32px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* App Container */
.app-container {
    width: 100%;
    min-height: 100vh;
    padding-top: var(--safe-area-top);
    padding-bottom: calc(var(--safe-area-bottom) + 80px); /* Bottom nav space */
    padding-left: var(--safe-area-left);
    padding-right: var(--safe-area-right);
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 0 16px 16px;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-small {
    margin-bottom: 16px;
}

.login-header h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--surface);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-group input:invalid {
    border-color: var(--error-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    padding: 12px;
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Header */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    margin: 0 -16px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 16px;
}

.user-department {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Status Cards */
.status-section {
    margin-bottom: 24px;
}

.status-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: var(--transition);
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow);
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.status-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
    line-height: 1.3;
}

.status-value small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
    font-family: monospace;
}

/* Geofence Status */
.status-card.inside-geofence .status-icon {
    color: var(--success-color);
}

.status-card.inside-geofence .status-value {
    color: var(--success-color);
    font-weight: 700;
}

#geofence-status:not(.inside-geofence) .status-value {
    color: var(--warning-color);
}

/* Activities */
.empty-activities {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.empty-activities p {
    margin: 0 0 4px 0;
    font-size: 14px;
}

.empty-activities small {
    font-size: 12px;
    opacity: 0.7;
}

/* Actions Section */
.actions-section {
    margin-bottom: 24px;
}

.actions-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.action-buttons {
    display: grid;
    gap: 12px;
}

.action-btn {
    background: var(--surface);
    border: none;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--shadow);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.action-btn.check-in .action-icon {
    background: var(--success-color);
}

.action-btn.check-out .action-icon {
    background: var(--error-color);
}

.action-btn.break-start .action-icon,
.action-btn.break-end .action-icon {
    background: var(--warning-color);
}

.action-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.action-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.action-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Activity Section */
.activity-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.activity-list {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

.activity-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.activity-info {
    display: flex;
    flex-direction: column;
}

.activity-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.activity-badge.success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.activity-badge.error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
}

.activity-badge.warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 8px 0;
    padding-bottom: calc(8px + var(--safe-area-bottom));
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 16px;
    right: 16px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px var(--shadow);
    transform: translateY(-100px);
    opacity: 0;
    transition: var(--transition);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 200px;
    width: 90%;
}

.loading-text {
    display: block;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Offline Status */
.offline-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-top: 16px;
}

/* Login Help */
.login-help {
    margin-top: 20px;
    padding: 16px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.login-help h4 {
    margin: 0 0 12px 0;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
}

.login-help p {
    margin: 4px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.login-help strong {
    color: var(--primary-color);
    font-weight: 600;
}

.offline-icon {
    font-size: 16px;
}

/* Settings */
.screen-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.back-btn {
    min-width: 40px;
    min-height: 40px;
}

.settings-content {
    max-width: 600px;
}

.settings-group {
    margin-bottom: 32px;
}

.settings-group h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.setting-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    box-shadow: 0 1px 4px var(--shadow);
}

.setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.toggle-switch:checked {
    background: var(--primary-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch:checked::after {
    transform: translateX(20px);
}

select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 14px;
}

.sync-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-container {
        max-width: 800px;
        margin: 0 auto;
        padding-left: 24px;
        padding-right: 24px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .login-container {
        padding: 80px 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .splash-screen,
    .app-header {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #FFFFFF;
        --text-secondary: #B3B3B3;
        --background: #121212;
        --surface: #1E1E1E;
        --border: #333333;
        --shadow: rgba(0, 0, 0, 0.3);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators */
.btn:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .bottom-nav,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }
}