* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px 20px;
    text-align: center;
    position: relative;
}

.logout-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.survey-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.survey-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}

.snackbar {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90%;
    text-align: center;
}

.snackbar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.snackbar.success {
    background: #27ae60;
    color: white;
}

.snackbar.error {
    background: #e74c3c;
    color: white;
}

/* Login Page Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-title {
    font-size: 28px;
    margin-bottom: 10px;
    color: #333;
}

.login-subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 14px;
}

.pin-input {
    width: 100%;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 4px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.pin-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.pin-input.error {
    border-color: #e74c3c;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% { transform: translateX(-5px); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pin-hint {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 10px;
}

/* Survey Page Styles */
.survey-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    min-height: 100vh;
}

.survey-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px 20px;
    text-align: center;
    position: relative;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.survey-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.survey-subtitle {
    opacity: 0.9;
    font-size: 14px;
}

.survey-form {
    padding: 40px 30px;
}

.form-question {
    margin-bottom: 30px;
}

.question-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-item:hover {
    background: #ecf0f1;
    border-color: #95a5a6;
}

.option-item.selected {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.option-item.wide {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .option-item.wide {
        grid-column: span 1;
    }
}

.option-checkbox {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.option-item.selected .option-checkbox {
    background: white;
    border-color: white;
    color: #3498db;
}

.option-text {
    font-weight: 500;
    flex: 1;
}

.other-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.other-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.survey-actions {
    border-top: 1px solid #e1e5e9;
    padding: 30px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-count {
    color: #7f8c8d;
    font-size: 14px;
}

.submit-btn {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-section {
    padding: 40px 30px;
}

.input-group {
    margin-bottom: 30px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.country-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 5px;
}

.country-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.country-btn:hover {
    border-color: #95a5a6;
    background: #ecf0f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.15);
}

.country-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
}

.country-btn .flag {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.country-name {
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 15px 50px 15px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.clear-input-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-input-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.buttons-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-entry {
    background: #27ae60;
    color: white;
}

.btn-entry:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
}

.btn-exit {
    background: #e74c3c;
    color: white;
}

.btn-exit:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
}

.logs-section {
    border-top: 1px solid #e1e5e9;
    padding: 30px;
    background: #f8f9fa;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logs-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.clear-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.clear-btn:hover {
    background: #7f8c8d;
}

.log-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.log-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.log-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.log-badge.entry {
    background: #27ae60;
}

.log-badge.exit {
    background: #e74c3c;
}

.log-country {
    font-size: 16px;
    margin-right: 5px;
}

.log-time {
    font-size: 12px;
    color: #7f8c8d;
}

.no-logs {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

/* Stats Page Styles */
.stats-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    min-height: 100vh;
}

.stats-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px 20px;
    text-align: center;
    position: relative;
}

.stats-title {
    font-size: 24px;
    margin-bottom: 10px;
}

.stats-subtitle {
    opacity: 0.9;
    font-size: 14px;
}

.stats-content {
    padding: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #ecf0f1;
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.chart-canvas {
    max-height: 300px;
}

.export-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-top: 30px;
    border: 1px solid #ecf0f1;
}

.export-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.export-description {
    color: #7f8c8d;
    margin-bottom: 20px;
    font-size: 14px;
}

.download-btn {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #ecf0f1;
}

.summary-number {
    font-size: 32px;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.summary-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

@media (max-width: 480px) and (orientation: portrait) {
    .stats-container {
        margin: 0;
        border-radius: 0;
        width: 100%;
        height: 100vh;
    }

    .stats-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) and (orientation: portrait) {
    body {
        padding: 0;
    }

    .container, .survey-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: none;
        width: 100%;
        height: 100vh;
        overflow-y: auto;
    }

    .form-section {
        padding: 30px 20px;
    }

    .logs-section {
        padding: 20px;
    }

    .survey-form {
        padding: 30px 20px;
    }

    .survey-actions {
        padding: 20px;
    }

    .country-selector {
        grid-template-columns: repeat(7, 1fr);
        gap: 6px;
    }

    .country-btn {
        padding: 6px 2px;
    }

    .country-btn .flag {
        font-size: 18px;
    }

    .country-name {
        font-size: 8px;
    }
}