/* css/styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #14b8a6;
    --secondary-color: #6c757d;
    --success-color: #10b981;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.login-container {
    background: var(--white);
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.logo-container {
    text-align: center;
    margin-bottom: 32px;
}

.logo, .logo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 16px;
    object-fit: cover;
}

.logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--white);
    font-size: 24px;
    font-weight: bold;
}

.logo-placeholder[style*="display: none"],
.logo[style*="display: none"] {
    display: none !important;
}

.login-form {
    width: 100%;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
}

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

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
}

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

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

.btn-primary:hover {
    background-color: #0d9488;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-icon {
    font-size: 20px;
}

/* Home Page */
.home-page {
    min-height: 100vh;
    padding-bottom: 80px;
}

.header {
    background: var(--white);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo, .header-logo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.header-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
}

.header-logo-placeholder[style*="display: none"],
.header-logo[style*="display: none"] {
    display: none !important;
}

.header-info {
    flex: 1;
    min-width: 0;
}

.employee-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.main-content {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.location-message {
    margin-bottom: 20px;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease-out;
}

.location-message.success {
    background-color: #d1fae5;
    border: 2px solid #10b981;
}

.location-message.warning {
    background-color: #fef3c7;
    border: 2px solid #f59e0b;
}

.message-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.location-message.success .message-icon {
    color: #10b981;
}

.location-message.warning .message-icon {
    color: #f59e0b;
}

.message-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.location-message.success .message-text {
    color: #065f46;
}

.location-message.warning .message-text {
    color: #92400e;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.punch-section {
    margin-bottom: 32px;
}

.punch-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.punch-history {
    margin-bottom: 32px;
}

.punch-record {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.punch-record h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.punch-datetime {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.punch-image-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: var(--light-bg);
}

.punch-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.logout-section {
    margin-top: 32px;
}

.powered-by {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 24px;
    margin-bottom: 0;
}

.powered-by strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Camera Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.camera-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

#video {
    width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    background: #000;
    transform: scaleX(-1);
    display: block;
}

.face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 70vh;
    border-radius: 12px;
    pointer-events: none;
    transform: scaleX(-1);
    z-index: 1;
}

.face-detection-status {
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.face-detection-status.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.face-detection-status.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

#faceStatusText {
    display: block;
}

.face-debug-info {
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.8;
    font-family: monospace;
}

.error-display {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #ef4444;
    margin-bottom: 12px;
    font-size: 12px;
    font-family: monospace;
    word-break: break-word;
    max-height: 100px;
    overflow-y: auto;
}

.camera-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.camera-controls .btn {
    width: 100%;
}

/* Responsive */
@media (min-width: 768px) {
    .login-container {
        padding: 40px 32px;
    }
    
    .header {
        padding: 20px 32px;
    }
    
    .main-content {
        padding: 32px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Footer */
.footer {
    background-color: var(--white);
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

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

.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-page .footer {
    margin-top: 40px;
}

.home-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
